Fala Felipe,
That was a doubt I always had, posted in thousands of places and forums and nothing!
What I got was a method, which exports the file .comic of Sqlite, and with this file I can view it in a program like DB Browser for Sqlite for example.
It’s a very Usitano way, but for me at least it works, do the following:
Put this method into your Mainactivity, or whatever the main class of your application:
private void banco() {
File f = new File("/data/data/br.com.packagedoseuprojeto/databases/ame.db");
FileInputStream fis=null;
FileOutputStream fos=null;
try
{
fis=new FileInputStream(f);
fos=new FileOutputStream("/mnt/sdcard/db_dump.db");
while(true)
{
int i=fis.read();
if(i!=-1)
{fos.write(i);}
else
{break;}
}
fos.flush();
Toast.makeText(this, "DB dump OK", Toast.LENGTH_LONG).show();
}
catch(Exception e)
{
e.printStackTrace();
Toast.makeText(this, "DB dump ERROR", Toast.LENGTH_LONG).show();
}
finally
{
try
{
fos.close();
fis.close();
}
catch(IOException ioe)
{}
}
}
Now call the method bank() within the Oncreate of its class.
How you can notice in the following line:
File("/data/data/br.com.packagedoseuprojeto/databases/banco.db");
You should change the package to the address of your application. This is the path where the file will be db bank. on your device, then you can open the file in the program DB Browser for Sqlite
It’s a very complex way to go, but it’s worked for me, if you get something easier I’ll be happy to know too.
If you have any questions you can send me private text.
Hugs.
http://facebook.github.io/stetho/
– itscorey