开发者

caching images/file in android for listview

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.

  1. Cache image on sdcard and corresponding entry in sqlite so that I can get path while listview is being scrolled.

  2. Cache images per activity so if activity finishes. Image cache flush开发者_开发技巧es

Point 2 is simpler but not efficient.

How will be the performance in point 1.

Please help and suggest any other alternatives.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜