Is there any way to pass database object between activities. I have already tried the following ways for doing this.
- Implementing interface.
- Using functions.
Is there any way to pass database object between activities. I have already tried the following ways for doing this.
I guess you are looking for a Singleton. Maybe this will help you:
If you are using a SQLiteOpenHelper I HIGHLY recommend you to read this:
I think you should be fine with Approach #1 which uses a singleton with the abstract factory pattern. Read the article its very informative. More on the topic and Pros n cons are here
There are several approaches that you can follow such as the use of Intent.putExtra() to pass your data objects from one activity to another