0

Possible Duplicate:
How to load an ImageView by URL in Android?

How to convert string to bitmap in android.I am getting url value in string .I want to set bimap in imageview can anybody tell how to do?

Thanks

Community
  • 1
  • 1
user386430
  • 4,837
  • 13
  • 41
  • 45

3 Answers3

0

This thread and especially this answer can helps you.

But you also have to care about the picture. Do you want to reuse it later? It that case, you can save it in your cache.

Community
  • 1
  • 1
thomasg
  • 571
  • 4
  • 17
  • What do you mean with "cache"? The SD card, the RAM? – schlingel Jun 05 '12 at 14:22
  • 1
    You can implement your own cache. Using [SoftReference](http://developer.android.com/reference/java/lang/ref/SoftReference.html) or implementing your own cache (on sdcard, for example). [Data Storage](http://developer.android.com/guide/topics/data/data-storage.html) is a good article to read about Android. – thomasg Jun 05 '12 at 14:26
0

I would recommend using Prime, I use it for all of my image loading.

HandlerExploit
  • 8,131
  • 4
  • 31
  • 50
0

This answer has the basic approach. Essentially, you need to first download the image from the URL, then you can set it to an ImageView, save it to your phone's SD card, etc.

If you're comfortable looking through other people's source code, this GitHub project shows you how you can store the image locally for reuse, run image downloads in a background thread, download multiple images for ListViews, etc.

Community
  • 1
  • 1
jmhend
  • 537
  • 1
  • 6
  • 16