This title makes me wonder on what is most suited feature in saving medium to large data on a specific application. I know there is a recent questions that i have seen on Stackoverflow regarding on saving data with these feature but I want to know, as what i have said, what suited most. Do you have any suggestion regarding to this?
-
Depends on the data. Does "medium to large" refer to the total volume of data or the number of records, or both? – MarsAtomic Jun 15 '13 at 00:43
-
@MarsAtomic : this "medium to large data" that i mentioned was refer to the number of records of data, thus, it varies also to its volume as it expands the data records. sorry for making it vague. :) – stryker Jun 15 '13 at 01:08
-
In your case I would suggest going with SQLite as it can be use to retrieve easily compared to File Storage. And Shared Preferences is usually meant for saving preferences and I personally think it shouldn't be used in your case. Also if you use file storage you will need to process more things manually. So I think SQLite is the best solution out of your options. – Milan Jun 15 '13 at 03:33
-
@Milanix : Thank you for your quick response. Your suggestion would much appreciated :). I also think that matter since then. Shared Preferences for this part has a long way to deal with this. I wonder, in terms of speed profiling in retrieving data, which is better? File storage or SQLite database? – stryker Jun 15 '13 at 04:04
-
1For retriving data i.e; sorting, ordering, you should mostly use database.Take an example of simple dictionary app one has database implementation and other has file. Let's search for "stack" if we have a file, we need to get all data from file into an arraylist and iterate through each items in the list to check in that item contains stack. But, if we have an database we can simply say select * from '_table' where '_word'="stack" and get back cursor that contains exactly what you want. – Milan Jun 15 '13 at 04:49
-
@Milanix : Yeah, that's also true. For SQLite database, its simply just dealing with SQL commands while for File storage, you have to deal with its algorithm code to satisfy its output. – stryker Jun 15 '13 at 04:55
-
Related: [What is the advantage of Using SQLite rather than File?](http://stackoverflow.com/q/19946298/514235) and [Android Performance : Flat file vs SQLite](http://stackoverflow.com/q/12212640/514235) – iammilind Nov 28 '16 at 11:19
2 Answers
Shared Preferences
Store private primitive data in key-value pairs.
Internal Storage
Store private data on the device memory.
External Storage
Store public data on the shared external storage.
SQLite Databases
Store structured data in a private database.
Network Connection
Store data on the web with your own network server.
as per official Website

- 860
- 2
- 17
- 41

- 14,139
- 7
- 51
- 71
Shared Preferences is better for things like settings or small amounts of data. Data stored in the Shared Preferences is stored in key-value pairs. This makes retrieving the data simpler, but there is not a really efficient way to query/search for a specific piece of data.
The database is an implementation of SQLite. This is useful when there is a large amount of records to store that all have the same/similar fields. Since it is SQLite, you can write queries to get specific records from the tables.
I do not have as much experience saving to the file system for storage, so someone else will have to speak to that one.
Here is a link to another stackoverflow discussion that compares SQLite and Shared Preferences. Pros and Cons of SQLite and Shared Preferences, as well as to the Android Documentation that goes into more details about how each method works. http://developer.android.com/guide/topics/data/data-storage.html
-
The comparison of SQLite Database and Shared Preferences are mostly concluded. However, I want to know also on File System part on how to make deal its data, considering on saving, its speed and efficiency. – stryker Jun 15 '13 at 04:46
-
1@stryker : Since you have a decent amount of data saving it in the file system would probably have poorer performance than the database. In order to access a piece of data you would need to load the file and parse it until you found the data you are looking for. If it needs edited, you would need to make the change and then resave the file. – JFeather Jun 15 '13 at 05:26
-
So by that means, it's just something to manipulate the file in and out, permission to read, write and/or execute. This particular matter will have a lot way to do. :) – stryker Jun 15 '13 at 06:40