0

The app I am making takes videos and pictures and displays them in a gridview. My hope is that the user will use my app frequently and take a very large quantity of videos and pictures. The problem I'm trying to figure out what route to take when storing the bitmap thumbnails. I'm currently using a SQlite database to store all the bytes and then querying them and creating a bitmap to be displayed. Even if I'm doing this in a background thread, this seems really inefficient especially as the database grows and there is more data to query through.

I feel using a memory cache would allow for faster retrieval and a better user interface. However, I'm afraid that if the user creates a lot of thumbnails then I run the risk of running out of memory.

My main questions are:

Is storing a bunch of thumbnails even something to be concerned about when caching?

Are there any advantages of using a SQlite database in this situation?

Thanks

Papajohn000
  • 809
  • 1
  • 16
  • 32
  • Go through [this post](http://stackoverflow.com/questions/541966/how-do-i-do-a-lazy-load-of-images-in-listview). In the simplest way James A Wilson shows you how to cashe data on short time memory. In the better way check the code in Fedor answer. You will learn how to do memory management in order to avoid out of memory exception. – Ali Jun 12 '13 at 14:00

1 Answers1

0

You shouldn't store the images as bytes, you should store the images as files in the cache folder and in you db you should only store the paths towards the images (or the name of the images if you know the folder). You should cache the thumbnails also, it will increase the speed when he looks through the list of thumbnails (resizing an image takes some time). P.S. You can use some 3rd part libraries for this.

bogdan
  • 782
  • 3
  • 7