Data Storage in App

  • Replies:5
Rackor
  • Forum posts: 19

Mar 18, 2014, 4:42:22 PM via Website

Hello everybody
short question from my side...i am programming an app where i want to save all the data from an user profil interface as an object for saving it on the device...therefore i am not sure in which way i should store it..directly on the internal device storage or in a structured database?
the advantage of a well structure from the database is not really important for me because i can save the object via an unique nickname i can refer to...so..any pros/cons of those two ways of data storage?

— modified on Mar 18, 2014, 4:45:41 PM

Reply
Deactivated Account
  • Forum posts: 39

Apr 1, 2014, 11:53:22 AM via Website

As I understand que -->
You want best way to store (serialize) object.
1. Using Internal file storage
pros :
1.You have more control over your data. PRIVATE_MODE gives security.
2.You don't have restriction in file dealing ie persisting / retrieving data.
3. uninstalling app , or doing clearing app data don't remove your data.
cons
1. You need to deal with internal storage memory available issue. Your app shouldn't consume much of users internal memory.

2. SQLLite
Pros: 1. SQL , deal with it using android sqlhelper class or use own SQL statements.Coding is easy. Best optimum file storage
2.Deal with memory ? No.
Cons :
1: when uninstalled app or user clicks on clear app data , removes all database
2. You need to follow DB structures.
3. Not much secured.

Reply
Rackor
  • Forum posts: 19

Apr 2, 2014, 2:24:39 PM via Website

Hey

Thanks a lot for your help!
I think i rather will take the internal storage techniques till i dont have much..it only will be a single user object or a couple for each profil interface..so few pics and then only text will need to be saved..so i think i wont have Problems with memory availability.
So this will be the best choice..
Unfortunately, i am a bit confused whether i should use shared prefernces..arent they quite similar than the internal storage usage? Just with the difference that they are quite easier to implementiert and to manage but just dont have that much possibilities..but for what i want..it should be enough i think?

Lg Rackor

Reply
Deactivated Account
  • Forum posts: 39

Apr 11, 2014, 6:18:07 AM via Website

For shared preferences , you can only save content for primitive datatypes.
I am not sure if blob datatype is available in shared preferences for storing images.Even if it is available ,you will have to stream images by yourself.
If you are using this streaming method , Please be aware of "VM memory Budget exceeds the capacity" exception.
Do test your app with HD images so that you can encounter this exception.

It is easy for you to directly apply images from internet storage to Imageview using Bitmap and drawable classes. Just you need to deal with files.

You can also use DB SQLite but you have store images in DB using blob datatype and have to stream manually.

At last , Please be aware of "VM memory Budget exceeds the capacity" exception , if you use low size images for testing , you wont encounter this problem but in real world , people may use HQ images.
I hope that is helpful for you !

Rackor

Reply
Rackor
  • Forum posts: 19

Apr 11, 2014, 10:58:43 AM via Website

Thanks a lot! you rly was quite helpful! think saving via internal storage fits the best even when i am saving images...and therefore i already dealt with the memory problem and i am already analysing and compressing the images
again...thanks a lot for your awesome help!

Reply
Deactivated Account
  • Forum posts: 39

Apr 14, 2014, 6:39:38 AM via Website

You are welcome !! :)

Reply