codingdir logo sitemap sitemap |
Home
PHP
C#
C++
ANDROID
JAVA
JAVASCRIPT
PYTHON

Android- Set Imageview to image from server


By : , Category : android

Use background thread to download anything from internet and update the UI views.

ReLated :

You should use lazy loading concept.You should look over below links:

How do I do a lazy load of images in ListView

Adding an unique parameter to the url makes the cache to always miss:

    urldisplay = urldisplay + “?timestamp=“ + System.currentTimeMillis();
    InputStream in = new java.net.URL(urldisplay).openStream();

But consider using some other identifier than the IMEI. It’s bad for user privacy to collect IMEI and will most likely not work if more than one user uses your app with the same device.

If adding the parameter is not possible, you can try adding “Cache-Control: no-cache” and “Pragma: no-cache” headers to your request:

    URL url = new URL(urldisplay);
    URLConnection urlConnection = url.openConnection();
    urlConnection.setRequestProperty("Cache-Control", "no-cache");
    urlConnection.setRequestProperty(“Pragma”, "no-cache");
    InputStream in = new BufferedInputStream(urlConnection.getInputStream());

send your image coded Base64 then decoded it in the server http://developer.android.com/reference/android/util/Base64.html

Why don't you use image downloading & rendering libraries like picasso & Universal Image Loader

Comments


Message :
Login to Add Your Comments .
How to disable registered OpenCL platforms on Windows?
Is Observable broken in Angular 2 Beta 3?
Cross-thread operation not valid when using Invoke
How to pass an IEnumerable or queryable list of properties from Controller to View
Finding numbers after a certain keyword using Python
Pocketsphinx recognizes random phrases in a silence
Passing non-thread-safe objects through thread-safe containers
React scroll nav
BizTalk WCF-BasicHttp Adapter does not allow Empty string for Service Certificate Props
Why property ''cause" of Exception is repeating forever?
Privacy Policy 2017 © codingdir.com All Rights Reserved .