Forums Register Login

Database vs filesystem which one is best for storing images?

+Pie Number of slices to send: Send
I am new on android and building an application which uses webservice to collect user information in xml.
I also get path for a small jpeg picture of each user. (Currently there are about 200 users)

I am parsing the xml and storing the information in SQLiteDatabase. Pictures are stored as blob and i m able to retreive them.
I display names of users on listview with images as well.

But is this a good solution for storing pictures in SQLite Database ?
Or should consider storing it in file system ?

Which is suitable in terms of performance , as well as memory and any other pro and cons on Android.

Also like to know which is best performing xml parser for Android ? My purpose is only to parse xml files which I get through webservices and sort out the data to store in storage.

And lastly my memory goes off easily when I load all images to display in list view after making thumbnails of each (which is obvious). Was wondering is there any library/framework/app available which dynamically loads images as and when required (when that list item is on display) something like Gallery program but in a list view ?

Any help highly appreciated. Thanks.
+Pie Number of slices to send: Send
"mob king", please check your private messages for an important administrative matter.
+Pie Number of slices to send: Send
 

Bear Bibeault wrote:"mob king", please check your private messages for an important administrative matter.



Thanks for reminding, I have done with that.
+Pie Number of slices to send: Send
Any Update on this ?
+Pie Number of slices to send: Send
We can't say what's suitable for your application; only you can. But it should be easy to compare a file-based storage approach with a DB-based approach in order to determine which one (or neither, or both) is sufficiently performant.

Android has SAX and DOM built in as part of the javax.xml package (just like Java SE), so unless you want/need to add additional libraries for some reason you should use those for XML handling.

Image processing is notorious for using a lot of memory. If it overwhelms the device, consider doing the processing on a server and keeping just the thumbnails (which should be quite small) on the device.
+Pie Number of slices to send: Send
Ulf Dittmer , Thanks for your reply. But for my last question , and in general , are there any libraries available that have implemented common functionality like custom widgets. If yes , where can I find them?
I have build a dynamic listview (images and names) that i read from database. I have also applied autotextview and filter to dynamically filter the list based on user input in Search box provided.
This works fine in emulator, as I load the whole list of images at one shot in memory and buffer it in array, so no problem , but a bad idea as the number of total images grow.
If I program it in a way to just load the current items that are visible on screen , my application response will be affected as user enters names to search and list getting generated dynamically, as it has to construct/load image for each item from database.

I found an interesting article that mentioned working of android GALLERY application, how it solves this problem by making a thumbnail of all images in a private folder for first launch and uses the same for subsequent launches.

My purpose is to know that do I need to write up the whole logic , or any framework already available ?
+Pie Number of slices to send: Send
 

Ulf Dittmer , Thanks for your reply. But for my last question , and in general , are there any libraries available that have implemented common functionality like custom widgets. If yes , where can I find them?
I have build a dynamic listview (images and names) that i read from database. I have also applied autotextview and filter to dynamically filter the list based on user input in Search box provided.
This works fine in emulator, as I load the whole list of images at one shot in memory and buffer it in array, so no problem , but a bad idea as the number of total images grow.


1. Not sure what you mean by "common functionality like custom widgets".
2. Yes it is a bad idea to load everything in shot if the list grows big.You should consider loading only what is to be displayed and not everything. Google "Droid Fu library for Android" they provide controls(custom ImageViews which lazy load images in background given image url). Perhaps you meant this in 1 above?

If I program it in a way to just load the current items that are visible on screen , my application response will be affected as user enters names to search and list getting generated dynamically, as it has to construct/load image for each item from database.


Try implementing the slow Adapter pattern in your ListView. Also, filtering should not be affected by this; just the loading of thumbnails. Usual practice is to show some default icon while loading the thumbnail in background(native applications do this).
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 6955 times.
Similar Threads
How to restrict access to image folders
Need weblogic specific classes to get reference to HttpSession object
whats the best way ?
Retreiving image through JPA and displaying it
which xml parser suitable 4 this?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:06:17.