I allocate this database queries object in several activities and fragments these are heavy static databases contains hundreds of thousands of records.
if I allocate and deallocate these objects this may incur heap fragmentation.does android automatically closes connection when context in which db connection opened is no longer exists even if I am not using context object while opening database connection.
public DatabaseQueries()
{
dbForUpdationList = SQLiteDatabase.openDatabase(
Environment.getDataDirectory()+"/data/package/databases/updation_list.db", null,
SQLiteDatabase.OPEN_READONLY);
dbForVillageWadiList = SQLiteDatabase.openDatabase(
Environment.getDataDirectory()+"/data/package/databases/village_wadi.db", null,
SQLiteDatabase.OPEN_READONLY);
}