Where Room save database Android?

后端 未结 6 1871
借酒劲吻你
借酒劲吻你 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:35

    static final String DATABASE_NAME = "photex_db";
    

    Here, you are trying to open photoex_db.

    String currentDBPath=getDatabasePath("photex_db.db").getAbsolutePath();
    

    Here, you are trying to read from photex_db.db.

    These are not the same.

    You might consider using DATABASE_NAME consistently, rather than only in some places.

提交回复
热议问题