0

Can anyone can create a database from SD card using Jellybean API 18?

but i should call this path like /storage/sdcard1. there are some many tutorials but does not work. Actually im using SQLiteOpenHelper.Some people says that if you create database from SD card, you dont need SQLiteOpenHelper.

1 Answers1

0

Solution: You just have to modify the constructor in order to change it's path:

public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    MySQLiteOpenHelper(Context context) {
        super(context, "/mnt/sdcard/mydb.db", null, 0);
    }
}

You can also get the folder string path and change it accordingly as you require. Ex: "/storage/emulated/0/folder/mydb.db"

Don't forget to add Write and Read Storage Permissions.

Try it, Hope it's helpful.

Ümañg ßürmån
  • 9,695
  • 4
  • 24
  • 41