0

My DataBase contains 1000's of images on server , I have to display these images in ListView in Android. I have to develop similar List like that in the Flipcart app(If User Scroll then download Images) and store a local copy in SQlite and display from that SQlite database.

(In future if connectivity would not be there then also I would be able to run my app) because Images will be available in SQlite.

Please suggest proper Solution for that. Use of loaderManager or something else please suggest

Skynet
  • 7,820
  • 5
  • 44
  • 80
Lokesh Tiwari
  • 10,496
  • 3
  • 36
  • 45
  • 1
    have you try any process? – Md Abdul Gafur Dec 28 '13 at 07:48
  • You have to Lazy Load images, you have to use an AsyncTask or a Handler thread, you have to override the adapter class and you have to cache images. Rather than storing them in DB a better approach would be to store them on SDCard and save the Uri in local DB. Check out this tutorial: http://www.vogella.com/articles/AndroidListView/article.html – Skynet Dec 28 '13 at 07:52
  • I was trying implementing "LoaderManager.LoaderCallbacks" but not sure whatever i doing is best and I am doing same downloading and saving in sd card and saving their uri in database. – Lokesh Tiwari Dec 28 '13 at 09:04

1 Answers1

1

I don't advise towards storing the images themselves in the SQLite database. The database will become slower to use and more cumbersome. Also, I think you should not implement such complex functionality yourself as there are many ready to use open source solutions.

There are a lot of solutions that allow you to cache the images on the file storage. They work transparently - when you request url they first check the local cache and only if this check does not exist they will make network call. Most of them also will display default thumbnail until the network call succeeds. Basically I think this is the best you can do.

I, myself have used Universal Image loader for what I describe, but out of this thread you can find many alternatives.

Community
  • 1
  • 1
Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135