In which path can I find the file of my SQLite DB?

1

I created a database to store answers from a survey, but I can not see my database, I do not see the package of my application and I can not even access the data / data / mi.example.myapplication / databases directory No may l!! Please, I need help.

EDITED:

Here, create my database and make it accessible from the memory card.

encuestadoSQLiteHelper encuestado = new encuestadoSQLiteHelper(this, "DBEncuestado", null, 1);
    final SQLiteDatabase db = encuestado.getWritableDatabase();
    try {
        File sd = Environment.getExternalStorageDirectory();
        File data = Environment.getDataDirectory();

        if (sd.canWrite()) {
            String currentDBPath = "/data/carpetahola/com.example.pablo.myapplication/databases/DBEncuestad‌​o";
            String backupDBPath = "backdatabase.sqlite";
            File currentDB = new File(data, currentDBPath);
            File backupDB = new File(sd, backupDBPath);

            if (currentDB.exists()) {
                FileChannel src = new FileInputStream(currentDB).getChannel();
                FileChannel dst = new FileOutputStream(backupDB).getChannel();
                dst.transferFrom(src, 0, src.size());
                src.close();
                dst.close();
            }
        }
    } catch (Exception e) {
        System.out.println("Surgió un error:"+e);
    }
    
asked by Pablo Gonzalez 08.03.2017 в 00:00
source

2 answers

0

Surely you will not be able to see your database because the device in which you are debugging the application is not rooted (super user), due to this the directory data will be empty or will not let you sign in, I hope I can help you, regards

    
answered by 08.03.2017 в 00:22
0

The database is accessible in several cases.

1- If the device is rooted.
2- If the device is not physical. It is an emulator.
3- If the database is saved in tarjeta SD

In the latter case, it must be borne in mind that not all phones have an SD card.

To save the base de datos in the tarjeta SD you must change the value of currentPath to /sdcard/

    
answered by 08.03.2017 в 11:22