I have two activity in my app say A & B. Activity A needs the data Stored by B (currently Shared Preferences). But to query the data in Activity A i need the context of B. But, Activity A does not have any way to get the context of Activity B(according to the application flow). Is there any way around or using database will be a better option??
Share
If you are storing in SharedPreferences then you do not need Activity B’s context. Activity A’s context can access the app’s SharedPreferences as they are ‘global’ to the app.
Code Example
As to define if you need a database, you did not say what the data was you are storing. Therefore it is impossible to tell.