How do I change the android database storage path? The default path for database storage is / data / data / databases,I want to save it to sdcard, how to do?
This is and old question, but answering may help others.
The easiest way to do this (only for debuggin environments) is to modify the constructor of the class:
public class MySQLiteOpenHelper extends SQLiteOpenHelper {
MySQLiteOpenHelper(Context context) {
super(context, "/mnt/sdcard/database_name.db", null, 0);
}
}
Remember to change for production environments with these lines:
public class MySQLiteOpenHelper extends SQLiteOpenHelper {
MySQLiteOpenHelper(Context context) {
super(context, "database_name.db", null, 0);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With