What is the best way to share one SQLite DB between several activities? Tables from the DB are shown in ListView, and also deleting/inserting records is to be performed. I heard
You could do this implementing a BaseActivity class what is extended by all Activity classes in the application:
public class BaseActivity extends Activity {
protected static SQLiteOpenHelper database;
@Override
protected void onPause() {
// TODO close database
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
// TODO open database
}
}
public class OneSubActitivy extends BaseActivity {
// methods using database from BaseActivity
}