Reputation: 1423
I have a listview with title and image in one row. And image is to come from remote server. Whats the best way to cache those images in android. I could think of two ways.
Cache image on sdcard and corresponding entry in sqlite so that I can get path while listview is being scrolled.
Cache images per activity so if activity finishes. Image cache flushes
Point 2 is simpler but not efficient.
How will be the performance in point 1.
Please help and suggest any other alternatives.
Upvotes: 0
Views: 8343
Reputation: 948
The answer is: it depends. You need to know if the application is going to access files on web every time you open an activity, and you need to know if the server images change frequently or not.
I think option 1 is a good option if images don't change frequently, and option 2 is a good option if images change frequently.
For more information, read this: http://developer.android.com/training/displaying-bitmaps/index.html
Upvotes: 3