Find the Sqlite database folder in android studio

Asked

Viewed 5,089 times

0

How to find the database folder in android studio ? Already tried tools -> Android -> Android device Monitor, the data folder is empty.

2 answers

0


In the code of your application you must have the address of your db try this address... Let me know if it works...

// The Android's default system path of your application database.
private static String DB_PATH = "/data/data/br.com.yourapp/databases/";

-1

Take the following steps:

  1. In Android Studio, go to Tools > Android > Device Monitor
  2. In the Device Monitor, in the left corner, select the device that is running
  3. Select the tab File Explorer Device Monitor. At this time the folders that are on the running device will appear
  4. Select date > date > package.da.sua.application > Database

If you want to download and preview the database file, just select the file and click on the option Pull a file from device, which is an icon of a floppy disk with a pink arrow in the upper right corner, between the tabs and the file explorer

  • 1

    The folder is empty, I would like to view the bank.

  • If you have done these steps and the file is not showing up, you are probably not creating the database correctly. The bank is created within the application in the method onCreate() of SQLiteOpenHelper or vc inserts it as a file in the folder Assets?

  • creating database like this: @Override public void onCreate(Sqlitedatabase db) { db.execSQL( "CREATE TABLE " + NOME_TABELA + (" + ID_USUARIO + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAME + " TEXT NOT NULL, " + EMAIL + " TEXT NOT NULL, " + PASSWORD + " TEXT NOT NULL );" ); }

  • Okay, but you also have to ensure that in some class you are creating an instance of SQLiteOpenHelper, because if you don’t, the onCreate() will never be called and therefore your bank will not be created.

  • 1

    I am ensuring this, do not give any bank error. The folder of my project I can not find on my smartphone.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.