Know Where Database Gets Stored In Android Studio
Android comes with a default database SQlite and it shortens the time for deployment, since there is no need to deploy and link a new database, it could be done in the Android Studio itself.
Let’s say you created a database with tables programmatically and your application worked perfectly, but you want to check whether the record inserted successfully in database table or not. This article is for those who doesn’t have an idea, where the database gets stored in Android Studio.
Let’s start!
Here, we have taken the following files,
Package: amit.net.OnlineElectionsApplication
Database Name: loginnew
Step 1:
Run application in which you created your database. Here, we have created an Application with Database name “loginnew”.
Run your application as in the following screenshot by going to Run, then clicking Run ‘app’.
You can also run by just pressing “Shift + F10″,
Figure 1: Run Android Application OnlineElectionsApplication
Step 2:
After running, just wait for the dialog box “Choose Device“, under that we will select our Android Virtual Device, which is “Coder” and press OK.
Figure 2: Select Android Virtual Device – Coder
Step 3:
After running, just wait for the emulator and launch your app. Here, the emulator will initially load like the following,
Figure 3: Initial running of Emulator
Step 4:
While the emulator runs successfully, now click “Android Device Monitor” as in the following screenshot. :
Figure 4: Run Android Device Monitor
You can also run Android Device Monitor by following the below given steps shown,
Figure 5: Run Android Device Monitor
Step 5:
After step 4, you will see a new dialog box for Android Device Monitor. Here’s the screenshot,
Figure 6: Android Device Monitor
Step 6:
Under File Explorer, click “data”, then again click “data”. Now, you can see the “File Explorer”.
Figure 7: File Explorer
Step 7: Here, we will select our project with package name, amit.net.OnlineElectionsApplication and locate our database as in the following screenshot,
Figure 8: Locating database loginnew.db
Here’s your database loginnew.db. In the next post we will discuss how to view this database with its tables and records which we inserted.
Here’s a video showing how to locate the SQLite database in Android Studio,
If you have more inputs to this, then please mention in the comments section below. We would really appreciate it.