How can I change the default location of a Room database?
问题 I want to change the location of the Android Room Database. I know that the database is inside of the files system, and I need to get root permissions, but I do not want to root my phone. The idea is change the database location to SD card, and can access it without root my phone 回答1: Just put the location path in the name of the database. I.e.: AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "database-name").build(); Put the router in database name. I.e.: