0

I was coped the existing sqlite3 database from assets folder to /data/data/"package name"/databases/ folder 3 different databases, for testing my code, using this code.

private void copyDataBase() throws IOException{
    Log.i("Tag", "Copy DataBase");
    InputStream mInput = mContext.getAssets().open(DB_NAME);
    String outFileName = DB_PATH + DB_NAME;
    OutputStream mOutput = new FileOutputStream(outFileName);
    byte[] mBuffer = new byte[1024];
    int mLength;
    while ((mLength = mInput.read(mBuffer))>0)
    {
        mOutput.write(mBuffer, 0, mLength);
    }
    mOutput.flush();
    mOutput.close();
    mInput.close();
}

Now I want to delete the two of them. How I can do that and where to find /data/data/"package name"/databases/ folder

ArmDroid
  • 209
  • 1
  • 11

2 Answers2

0

You cannot access the folder by using a normal Explorer on Android. To do this you need a rooted device or explorer with root access.

The easiest way to delete this files (if you dont know the exact name) ist clearing the Cache and Data in Settings > Apps > All App > "Your App Name"

Remember that this will delete all 3 databases.....

zrb
  • 53
  • 7
  • Can't find Settings > Apps > All App , I use android studio. – ArmDroid Sep 12 '14 at 20:51
  • Its on your mobile Device.... Another way ist [this](http://stackoverflow.com/questions/5694385/getting-the-filenames-of-all-files-in-a-folder) You can adapt this to list all files in a folder an then write some code to delete specific files – zrb Sep 13 '14 at 05:49
0

Just uninstall app from device, and all the data will be deleted, And when run app again, with new database name. The path creating in device but need a root access to explore it "zrb" is right.

ArmDroid
  • 209
  • 1
  • 11