Android – Using External SQLite DB File from SD Card

androidmemorysqlite

I just searched for the same but didn't get the answers. What I have is a db file which is around 100MB. I have saved the db file in sdcard .

Through this db file I'm going to populate the contents for the android app. I can read the db file using like below.

File dbfile = new File("/sdcard/Your_db_File.db" ); 
SQLiteDatabase  db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);

What I'm concerned is about the memory. I have read like in assets it has some memory limitations. I'm just worried like will 100MB of db file in sdcard or external memory is a harm or is it OK to have 100MB db file? Or is there any limitations for sqlite db file in external storage as well? Suggestions are appreciated.

Best Answer

SQLite itself has no problem with 100mb databases, as you can see here it can handle upwards of 140TB in a single database file.

As for Android, each system has different constraints since various providers can decide how much physical memory to install along with which apps run at startup, etc.

I imagine there should be little problem with a 100mb database since that is effectively quite small, however the only real way to know would be to test it on a variety of target devices in a variety of scenarios.

Related Topic