I need some suggestion here on the Sql database approach for storing rss feed data
First : My rss feeds gives image url links which i diplay using bitmap and inputstream at runtime but now for offline purposes so as to use app when internet not available how do i load them, do i need to save complete images like whatsapp does right ? is this approach right ? if yes how to save complete images in database ? a sample code will help.
Last i want to save the complete database on sd card not in internal memory , storing data on sd card will work fine or it will create problem ? because whatsapp or many other apps stores quite a data in internal memory !! if storing on sd card is not a problem how do i store complete data on sd card ?
If your image comes from your online server, use cache then save the URL to your SQLite database together with the other data you need to access when offline.
As for the downloading and caching approach for images you can see this link:
http://theandroidcoder.com/utilities/android-image-download-and-caching
Once the image is downloaded and cached you can view it even offline. :) Or else you may want to store the whole image and save it in a specific path on your phone and access it when internet connection is not present.
As for your idea on storing in SD card. there is only one problem I can think about. When the SD card is removed, all your data is lost. You should search on how to better handle data on your phone as well as do as research on storing in external storage for this one. It's now on your end to do some research about it to further understand its risk and advantages.
Related
I am downloading a number of small images from the server. My question is: where do I store them? The images are icon size and I am expecting at the very most 100 of them. I want to use a HashMap to store them. But I am wondering if I should be storing them on the SD card. And if I decide to store them on the SD card: Do I have to "inflate" the bitmap each time a user calls the image (which is used on multiple activities) or would I be storing them in a data structure anyway at that point? To me the obvious answer is HashMap. But just in case I overlook something, does anyone know reasons for which way I should go?
Why not cache them on external storage or internal storage? This is actually how Android Gallery has done. You can find cache file at /sdcard/Android/data/gallery_package/cache/cache_file. In Gallery, you can access Picasa data which will be downloaded by gallery and cached to local disk. when drawing these data on screen, you can load them from cache directly.
I need to store the list of downloaded image in device.I need to know what is the best way for storing images.If i store it in sd card when the user removes the sd card from device.In that situation how to overcome this problem.
If you are bothering about the sdCard removal then only on option is available to save on phone memory that is always available.
Or if you have Internet available what about moving to cloud ???
but if the main concern is security of Images you can go with the answer of user #shree202
For the security purpose you can change the extension
Say From JPG ==>> .db
it is use less for other applications and also user manually can't change the extension
and also for more secure way You can encrypt it by changing it to byte.
If you are going to open the images right from your own application, then, you can remove the extension of the image file and then save. After that, while accessing the image you can get the file list and display it again in your application by appending the file extension.
i want to display around 1000+ images into an application. Which is the most effective way to store images, on device or in database ?
I am using sqlite database in my app.
Store your image on server than download it in device, save your image into sdcard as a cache or simple image. At download on single success of image store its path into your table and used in your application.
Use Lazy loading concept to load image in application. Its better to store image in sdcard rather than in database.
In android or ios dont save large images into database In sqlite or in core data it can lead to database inconsistency and the database like sqlite are not designed for saving large images.
In android use
Internal Storage or External Storage
In ios use
iOS File System
It will be better if you store the image in server. But if you dont have access to a server, then store the image path in SQLite database and have the images in sdcard. It is always a good programming practice to do like this.
I have a question about saving images in an SQLite database location in the app.
I made an app for iOS where users can snap a photo or grab an existing one from the app that saves them in a local bank in own app, since the IOS does not have so many problems with disk space.
On Android already have code that takes the photo or use an existing one, now wanted to know how save them in SQLite database. (?)
I've been reading about and some suggest saving the image in SD card and insert into the database only the image path, but if for some reason it is excluded from the SD card will have an error in your application for the path referenced no longer exists.
What would be the ideal solution for this?
You should only keep the name of the picture in the database and store the picture on the internal storage, not on the sdcard, save them in the first place as private to your application only.
The ideal solution is to store it in the SD card. Storing in DB won't keep the user from deleting it. You'll also lose this information if the user clears the app data. All databases are deleted when the user does it.
Anyway, if you choose the SQLite solution, you can use a blob field. Remember that some versions of SQLite won't support large blob data. Check this out:
http://effbot.org/zone/sqlite-blob.htm
I also suggest this:
http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
Is there some way where I can just link the images from the phone to my sqlite database? At first I thought of storing them in the phone memory in a new database but I am thinking that will blow away the space. Can anyone plzz help.
Where are the pictures? Are they just files? If so, just store the filename to them as a string? If you're talking about the images in Android's media storage, you can just store the Uri to the content provider as a string (i.e. whatever you're using to retrieve it via MediaStore.Images).