Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the live view of inserted data in Sqlite database on Android Studio

Will you please help me with this problem.

I'm inserting values to my Sqlite database.

How can I check or view the inserted data.

Is there is any tool or other techniques to show the data ?

like image 576
Bivin Vinod Avatar asked Mar 11 '18 06:03

Bivin Vinod


People also ask

How do I view the contents of a table in SQLite?

If you are running the sqlite3 command-line access program you can type ". tables" to get a list of all tables. Or you can type ". schema" to see the complete database schema including all tables and indices.


1 Answers

If You Want to Show a data on Log try below code :

for (Contact cn : contacts) {
            String log = "Id: "+cn.getID()+" ,Name: " + cn.getName() + " ,Phone: " + cn.getPhoneNumber();
                // Writing Contacts to log
        Log.d("Name: ", log);

Other Way to show a database see below steps:

  1. Go to Tools -> DDMS or click the Device Monitor icon next to SDK Manager in Tool bar.
  2. Device Monitor window will open. In File Explorer tab, click data -> data -> your project name. After that your databases file will open. Click pull a file from device icon. Save the file using .db extension.
  3. Open FireFox, Press Alt , Tools -> SQLiteManager.
  4. Follow Database -> connect to Database -> browse your database file and click ok. Your SQLite file will opened now.

If you Download a database on DDMS then You download

DB.Browser.for.SQLite-3.10.1-win64

and put the database file on this software and you get the data.


NEW UPDATE OF DDMS

  • I'll Update My Answer becoz now a days Android Studio update in Android Studio 3.1 or up to other like now 3.2 in this Studio DDMS function is not available but Don't Worry i have another solution.

  • In your android Studio See right side Bottom Corner there is one Option like Device File Explorer Click on this button

After that you can see like below image is open on your screen :

enter image description here

Now select data -> data -> your project name. :)

like image 153
Ali Avatar answered Oct 12 '22 04:10

Ali