I have now sorted my problem. I used an ExpandableListView so globals were not needed.
On Feb 3, 10:55 am, MB <[email protected]> wrote: > How would you useglobalvariables? That is what I would like to do. > I have different files for each Activity so I was not sure how to have > globals across them. > I need the LinkedList to be shared over various Activities so I can > use data from it without replication. > > On Feb 2, 6:02 pm, Dianne Hackborn <[email protected]> wrote: > > > 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 useglobalvariables for this kind of stuff. > > > On Sun, Feb 1, 2009 at 5:29 AM, MB <[email protected]> wrote: > > > > I want to create aglobalvariablestorefor 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.Applicationclass > > > The android.app.Applicationis a base class for those who need to > > > maintainglobalapplicationstate. 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 > > >applicationstart and then use it throughout without any duplicates > > > etc. > > > > Does anyone know how the android.app.Applicationclass can be used as > > > aglobalvariablestorethat can be accessed from other classes? > > > I cannot find any more information on this method of passing > > > information between Activities within a singleapplication. 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 -~----------~----~----~----~------~----~------~--~---

