How to See SQLite Database Data Saved in Device using Android Studio

How to See the SQLite Database?

Here is How to See SQLite Database Data Saved in Device using Android Studio. This post has the steps to see the data stored in the SQLite database in the device. This is an extended post of our previous post Example of SQLite Database in React Native and Example to Load Pre Populated SQLite Database in React Native.

There are lots of confusion in people related to How to see the SQLite database? and that is the main reason behind writing this post. While developing the application either we provide the pre-populated database or make the database at runtime but in both cases, we can not see the database of the device directly.

If we talk about the database that we make in runtime then we can understand that but most people get confused in the second case when we use the pre-populated database. In the second case, they provide the database from as a reference in the asset /www directory and that database will be used by the application and after modifying the data in the database they look for the change in the same database which is confusion point.

So let me clear that. When you are providing the database while developing the application, app builder takes the database from the reference location and copy it to the APK and after deploying that APK into the device the database will be managed in the device only so the database that you have provided on your PC/laptop is just for the starting, it is not the same database that device modifies.

Hope you got my point. Now the question comes in everybody’s mind is How to See SQLite Database Data Saved in Device. So here are the steps to see the SQLite database of the app installed in a particular device:

Note: You can only see the database of the debug app, not of the release app.

Open SQLite Database Stored in Device using Android Studio

1. Insert the data in the database

I know it’s not a point to mention but believe me, I got some queries in which people forgot to insert the data in the database but still, they want to see the data. So for the safer side insert the data in the application’s database using your app.

2. Connect the Device

If you are working with the Real Device, you can connect it with the development machine or if you are using emulator then you are ready for the next point.

3. Open Android Project

Launch Android Studio and open File > Open > “Your project”/android directory. It will open the Android project.

4. Find Device File Explorer

After opening the Android Studio you need to find the “Device File Explorer” which you can generally find at the right bottom of the Android Studio. If you have successfully found the option then you can click on it.

If you are unable to find the Device File Explorer then try to find view option in the top menu and hover over “Tool Windows”. Here you will see the “Device File Explorer” option just click on it.

5. Select the Device

After clicking on it, you will see a window. At the top of that window, you can see a dropdown with a list of devices connected with your development machine (also includes emulators). Select the device from which you want to see the Realm database. Select the device and expand the data option.

6. Find Package Name

Find the package name of your application in the list.

7. Export the SQLite database file

Expand the application package directory and expand the database directory under that. You can see the database you have created. After finding the database right click on that and save it to any directory.

Please save the database on a known location. (This process is like downloading the database from the mobile application to your PC/Laptop)

8. Download SQLite Browser

You can download SQLite Browser from here and can install it. This SQLite browser will help you to see the content of the exported database file.

9. Open the exported file in SQLite Browser

If you have successfully installed the SQLite browser or already have any then you open it.

Now Open the database using File > Open Database> Select the exported DB file.

10. Done

If you are lucky or have followed every step then you will be able to see the database in SQLite Browser. You can explore SQLite Browser and can query the data as per your need.

This is how you can See SQLite Database Data Saved in Device using Android Studio. If you have any doubts or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂


Related Posts

4 thoughts on “How to See SQLite Database Data Saved in Device using Android Studio”

  1. Thank you so much for the article! Indeed it cleared up an issue that alot of beginners are dealing with (including me!) but rarely pointed out.

    Reply
  2. Thank you for sharing! My problem is that I know that my data was inserted into the SQlite, because I was able to view them on the device. However, I couldn’t view them using the DB Browser and following your steps. I want to it to work but not sure where to go from here.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.