1

I use Room to save my data :

@Database(entities = {Colis.class}, version = 1)
public abstract class ChloeDatabase extends RoomDatabase {

    public abstract ColisDao colisDao();
    private static volatile ChloeDatabase INSTANCE;

    public static ChloeDatabase getDatabase(final Context context) {
        if (INSTANCE == null) {
            synchronized (ChloeDatabase.class) {
                if (INSTANCE == null) {
                    INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
                            ChloeDatabase.class, "my_database")
                            // Wipes and rebuilds instead of migrating if no Migration object.
                            // Migration is not part of this codelab.
                            .fallbackToDestructiveMigration()
                            .build();
                }
            }
        }
        return INSTANCE;
    }
}

But what I really want is to save data in sdcard in sqlite format (so that I can export my_database.sqlite file in /sdcard/Android/data/my_package/my_database.sqlite, whether it's on a emulator or a real device).

I searched for a whole day on Internet without finding the solution. Could anyone help me with this issure ?

hawarden_
  • 1,904
  • 5
  • 28
  • 48

1 Answers1

-1

You can extract your database, after you have connected your emulator or physical device like this:

  • Go to DeviceFileExplorer

  • data

  • data

  • find you app name

  • databases

    and than find your database. It is the file with the larger size . Than drop it to your phone storage. After that if you want to check your data in your computer, you can perform queries in Sqlite syntax with this little toy here .

Community
  • 1
  • 1
coroutineDispatcher
  • 7,718
  • 6
  • 30
  • 58