I need multiple tables in my application. For this I’ve created separate subclasses of SQLiteOpenHelper to insert/remove/update data for different tables. My question is how can I make sure all these subclasses uses same instance of SQLiteDatabase across the entire code. Though I’ve made each subclass a singleton. However, I couldn’t work around the issue of using a common SQLiteDatabase instance across the entire code.
PS: I don’t want to use a ContentPovider or create a single SQLiteOpenHelper subclass as this would complicate my code.
I don’t really see where you’re struggling at using a common
SQLiteOpenHelper. You just have to duplicate what you do for one table ! Create a custom class that extendsSQLiteOpenHelperand do the duplication.and then in the class where you perform some database actions :