This question already has answers here:
Adding an assets folder in Android Studio
(5 answers)
Closed 6 years ago.
I am developing a Quiz application. I need to store the questions and answers(options) some where in the app so that I can fill the TextView's RadioButton's in a Activity Dynamically. How can I store such data and Access it to fill my Activity.
I am not sure about the concept. Please suggest the best way to do this.
you can use shared preferences to save local data, to check it in file folders manner you can use DDMS. You can also use SQLite.
Related
This question already has answers here:
How to save data in an android app
(12 answers)
Closed 6 years ago.
hi guys i wanted to save data in android application but i dont want to use shared preferences concept. can i save data on a text file in phone and perform read/write operations on it evertime I open my app for example update hall of fame everytime when game is over?
There's a list of available options in the officional developer guide:
https://developer.android.com/guide/topics/data/data-storage.html
The following options are explained there:
Store data using shared preferences
Save data to files on internal or external storage
Store data in SQLite databases
Store data on the web
This question already has answers here:
Ship an application with a database
(15 answers)
Closed 7 years ago.
I wanna develop an application which has a database which is filled with data. How should I fill the database with data? which of the following should I do?
1- Write a little android app and fill the database and somehow get access to the database file and put that in the app. (I think this is bad)
2- Use some kind of sqlite software to fill the database file and then access the database file and put that in the app.(Again I think this is bad)
3-Any other method.
If the data is not huge, you can download the data from server and fill sqlite database when the user first starts the app.
If the data is huge, you can store the data in a file and put under /res/raw folder of the apk and write code to copy those data to sqlite when the app starts for first time.
This question already has answers here:
Ship an application with a database
(15 answers)
Closed 8 years ago.
I have an app that just need to read from a database. I do not want to parse a big file in the app because it takes a lot of memory.
So is it possible to populate a database and ship it with the app?
Just parsing the file and storing it in the app the first time the app is run will not do since it will create the same memory problem.
An alternative would be to have the database on Google Appengine but I would like to avoid that because the app would be unusable if there is no internet connection and there are costs for the traffic.
So is it possible to populate a database and ship it with the app?
Yes. Create a SQLite database containing your data, then package it with your app using SQLiteAssetHelper. It will be unpacked into position when you first try to use the database.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Multiple database in single app in android
I have one app with it's database file. Now i want to build another database file in this app to store another kind of data. Is it posible?
Though it is possible to have multiple database in single app, still I will suggest to have multiple tables in single database instead of multiple database.
Here is a solution to create multiple database.
How to add multiple database in single app
This question already has answers here:
Ship an application with a database
(15 answers)
Closed 8 years ago.
I have seen many solutions which are code oriented, like if you have to create a table, you would have to create it using code, but this is not good for complex applications, as we have SQLite Browser to create database and its tables, and it generates a database file.
Now the question is, where to place that file in my project, there is no data folder in eclipse project, I dont know what to do, its interaction is not like MySQL where we use driver or connection?
You can follow this steps to use an existing database in your application:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
I've also made a blog post some time ago which combined the solution above with the use of ormlite:
http://www.b-fil.com/blog/2011/01/20/android-repository-ormlite-existing-sqlite-db/