Where Room save database Android?

后端 未结 6 1884
借酒劲吻你
借酒劲吻你 2020-12-30 02:39

I am using Room library to save data in database.i want to get database.

used this code

  private void copyFile() {

        try {
            File s         


        
6条回答
  •  盖世英雄少女心
    2020-12-30 03:33

    Try out this code :

    String backupDBPath = YourRoomDatabase.getDatabase(context).getOpenHelper().getWritableDatabase().getPath();
    

    It will return the path of your database. Use this exact path to create the file where you want to copy it. It will definitely work as worked for me.

    File backupDB = new File(backupDBPath);
    

提交回复
热议问题