What is the SQLITE directory?

0

Where is the SQLITE database I created in the android studio IDE? I searched and did not locate, and I did not even find it on the phone itself.

    
asked by anonymous 06.12.2014 / 02:50

1 answer

1

For this I did:

File f=new File("/data/data/seu.app.package/databases/seu_db.db3");
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 OK", Toast.LENGTH_LONG).show();
}
catch(Exception e)
{
  e.printStackTrace();
  Toast.makeText(this, "DB ERRO", Toast.LENGTH_LONG).show();
}
finally
{
  try
  {
    fos.close();
    fis.close();
  }
  catch(IOException ioe)
  {}
}

Give the permission

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

It's not brilliant, but it works

    
08.12.2014 / 21:51