View database records in Android Device with Stetho

Today we will talk about pretty cool tool for every Android developer who uses SQLite. And this is the Stetho who developed by Facobook.

With Stetho you can view your SQLite records on the device very easily. All you need to do is add this line to your build.gradle file:

compile 'com.facebook.stetho:stetho:1.4.2'

And add this line to your Activity onCreate() method:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Stetho.initializeWithDefaults(this);
    setContentView(R.layout.activity_main);
}

And that it. When the app is running, you can browse very easily inside database, by opening chrome  in the url:

chrome://inspect/#devices

Then you will see something like that:

 

 

 

 

 

 

 

Then the Developer Tools window will pop up. In the Resources tab, under Web SQL you will be able to find your database:

 

 

 

 

 

 

The records display is something like this:

 

 

 

 

And that’s all!

More details can be found here:
http://facebook.github.io/stetho/