Just make a subclass, put its name in the <application> tag in your manifest, and retrieve it from the activity and cast it to your class.
Though personally I would just use global variables for this kind of stuff. On Sun, Feb 1, 2009 at 5:29 AM, MB <[email protected]> wrote: > > I want to create a global variable store for a list of user defined > objects. > > I have a LinkedList of Feed (a user defined object) that I need to be > made available to a new Activity that is created. > This list is displayed using a ListView and so when an item of the > ListView is clicked, I need the correct Feed index to be 'passed' to > the new Activity. I have no problem doing this as I create an Intent > and then pass the id of the selected row. > I need the new Activity to have access to the LinkedList of Feed > objects. > > There are different ways to do this (explained here - > http://code.google.com/android/kb/framework.html). > I want to use the option (quoted from link above): > The android.app.Application class > The android.app.Application is a base class for those who need to > maintain global application state. It can be accessed via > getApplication() from any Activity or Service. It has a couple of life- > cycle methods and will be instantiated by Android automatically if > your register it in AndroidManifest.xml. > > I want to use the above method as I could then fill the LinkedList at > application start and then use it throughout without any duplicates > etc. > > Does anyone know how the android.app.Application class can be used as > a global variable store that can be accessed from other classes? > I cannot find any more information on this method of passing > information between Activities within a single application. Any > information regarding passing user defined objects would be useful and > specifically how to get the above idea to work. > > Cheers, > MB. > > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

