Global Objects accessible throughout Android apllication
<p>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.</p>

<p>Basic data is then shown in a ListView from which you can select a ListView item to see further information displayed in another Activity.</p>

<p>Currently, I am having to pass the data that is relevant to the new Activity to it by using: </p>

<pre><code>intent.putExtra("NAME", value);
</code></pre>

<p>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.</p>

<p>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.</p>

<p>I've just looked into using:</p>

<pre><code>MyApp myapp = ((MyApp)context.getApplication());
</code></pre>

<p>but this won't work unless I can pass the context around, which I'm not sure how to do??</p>

<p>In C# you'd create a static class that could handle this....</p>

<p>Thanks
Neil</p>
