I have an application that uses a custom class. When the app is started I populate an instance of this class in the main activity with all the data it will hold.
Basic data is then shown in a ListView from which you can select a ListView item to see further information displayed in another Activity.
Currently, I am having to pass the data that is relevant to the new Activity to it by using:
intent.putExtra("NAME", value);
I want to implement a ViewPager so the user can easily switch between ListView items. Therefore the currently use method isn't very good as I only have the data for one entry at a time and would need to get back to the original Activity to get all the data again.
Is there a way to have my class objects globally available ANYWHERE in my application? I feel my applications code is getting bloated as I am overcoming these issues in bad code methods.
I've just looked into using:
MyApp myapp = ((MyApp)context.getApplication());
but this won't work unless I can pass the context around, which I'm not sure how to do??
In C# you'd create a static class that could handle this....
Thanks Neil