I have an android app that I have been working on and I created a sqlite database using the android.database.sqlite
package. I know that you can access that data by using Android Studio manually, but I am trying to save data into the database so that if one user of the app does something to add to the database, another user of the app will have the same access to the database. Will the android.database.sqlite
package allow this or will the database for each user be unique to that user? If this is the case in which all users cannot access the same database after updating, what is the best way to go about creating a database that would let every user access it even when updates occur?
Asked
Active
Viewed 697 times
1
1 Answers
0
It is possible to add multiple users to a local application. Here is the simplest way to accomplish this:
1) Create a table for users in your database, with a user ID
2) Every user specific value in other tables should be marked to corresponding users with this ID
3) When you fetch the data from database, use the Select statement specifying user
Tip: Android has an Object-Relational-Mapping Library called Room for making database creation simpler. Reading about Room would help too! Take database classes for gaining knowledge about such common tasks.

Sachin Titus
- 1,960
- 3
- 23
- 41
-
Thank you very much! I appreciate it. I will definitely look into reading about Room. Would you suggest this is the best way to go about it, or should I create a sqlite database apart from android studio and connect the app to that database? – Victoria Feb 12 '18 at 20:41
-
Do you wish to learn Android cleanly? I can provide you the links I used. It's a free tutorial by Google, explaining everything we need to know as a developer, step by step – Sachin Titus Feb 12 '18 at 20:43
-
This is how it works..SQLite Database is created inside the program using Java code! Database should not be directly accessible from the code for security reasons. There's should be a Content provider between database and app code, which talks with the database for read, write, update and delete requests. Content Providers makes even App to App communication possible! – Sachin Titus Feb 12 '18 at 20:50
-
Yes, I would really appreciate the links! – Victoria Feb 12 '18 at 22:39