is there any way, how to create and use database from SD card in my app instead of /data/data/com.myapp/databases directory? I know is it unsecure, but are there any special restriction like "database on SD card cannot be bigger then 2GB"?
Thanks
Hmyzak
The Android SDK provides dedicated APIs that allow developers to use SQLite databases in their applications. The SQLite files are generally stored on the internal storage under /data/data/<packageName>/databases.
An SQLite database is normally stored in a single ordinary disk file. However, in certain circumstances, the database might be stored in memory. The most common way to force an SQLite database to exist purely in memory is to open the database using the special filename ":memory:".
SQLite is an open-source relational database i.e. used to perform database operations on android devices such as storing, manipulating or retrieving persistent data from the database. It is embedded in android bydefault. So, there is no need to perform any database setup or administration task.
Uploading-SQLite-Database-to-Google-Drive-in-AndroidCreate a new app in android studio. Register and "enable" "Google Drive Api" and Google Drive SDK. Create Java files- MainActivity. java and CloudBackup.
he is a proposed solution which i found in stackoverflow
File dbfile = new File("/sdcard/android/com.myapp/databases/mydatabase.db" );
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);
System.out.println("Its open? " + db.isOpen());
here is the link.
UPDATE
i am not sure you can use this along with SQLiteOpenHelper, but you sure can query the database object.
db.getVersion();
db.execSQL(sql);
db.beginTransaction();
db.endTransaction();
db.setTransactionSuccessful();
db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
you can do all the things which you expect with a database. SQLiteOpenHelper in only a wrapper class which helps you the extra which we always can do on our own.
EDIT as for your file size limit i found this link. Is there a file size limit on Android Honeycomb?
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