Supriya ghadge
Supriya ghadge

Reputation: 11

database folder is missing in device file explorer in android studio

I have created a sqlite database and table in android studio, but the sqlite database folder is missing in the device's file explorer. I have written the following code in the databasehelper.java class

@Override
public void onCreate(SQLiteDatabase db) {
   db.execSQL("create table "+TABLE_NAME+"(sr INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, datetime TEXT, location TEXT, odometer INTEGER, speed INTEGER, GPS TEXT, int.volt INTEGER, ext.volt INTEGER )");
}   

Upvotes: 0

Views: 4200

Answers (5)

Pridev
Pridev

Reputation: 1

1 create table 2 upgrade table 3 insert value in table 4 (make sure that) add table field in List and call the method in MainActivity eg. - db.gelAlldata(); 5 then run and synchronize ur project package

Upvotes: 0

Dharaneshvar
Dharaneshvar

Reputation: 1688

There might be a possibility that you have not connected the android device in USB file transfer mode. I had this issue in Android 9 and fixed it by connecting the device in USB file transfer mode.

Upvotes: 2

Sajid khan
Sajid khan

Reputation: 615

Firstly you need to check that your database is successfully created or not, if your database is created then you can follow these steps:

  • Step1 : Debug you device with the breakpoint on the createdatabase().
  • Step2 : After the successfully database create, Open the Device File Explorer, Go to the your Package and right click onto the package name.
  • Step3: Synchronize you package, now you will get your Database

Upvotes: 0

Supriya ghadge
Supriya ghadge

Reputation: 11

solved this issue. now my database folder is visible in device file explorer. i delete my old database. also remove databaseHelper class. and create a fresh database and table. may be i missed some steps while creating database thats why database folder is missing. now its working.. thank you for ur help

Upvotes: 0

binay37
binay37

Reputation: 131

The default location of database is

/data/data/<your_app_packagename>/databases/db_name. 

It is not accessible in non-rooted devices. You can create your database in different location for debugging.

Upvotes: 0

Related Questions