Thanks for your help. I have implemented my new class and done the pass from one activity to another.
And you just point out a problem that I have not thought about before ---- life cycle, thanks for your suggestion. 2010/4/20 ~ TreKing <[email protected]> > On Mon, Apr 19, 2010 at 1:24 AM, Ke Wu <[email protected]> wrote: > >> I dont know what the Intent exactly do when I use putExtra to pass in an >> ArrayList<MyClass> object. >> > > Did you read the documentation on Intents? Specifically this: > http://developer.android.com/intl/fr/reference/android/content/Intent.html#putParcelableArrayListExtra(java.lang.String, > java.util.ArrayList<? extends > android.os.Parcelable>)<http://developer.android.com/intl/fr/reference/android/content/Intent.html#putParcelableArrayListExtra(java.lang.String,+java.util.ArrayList%3C?+extends+android.os.Parcelable%3E)> > > >> I guess MyClass need to implement Parcelable interface, so I just did it. >> But still, it does not work. >> > > You guess right. If it does not work, you should explain what doesn't work. > Just saying "it does not work" is useless to someone trying to help you. > > >> Maybe I need to create a Bundle and then use Bundle' putParcelableArrayList >> method to put my ArrayList<MyClass> object in, and then pass this bundle as >> parameter of putExtra to the intent. >> > > No. > > >> So crazy! >> > > Not really! > > >> I am lazy >> > > Then you should not being doing Android development ... or any kind of > programming for that matter. > > >> , I just want to pass an ArrayList<MyClass> object simply, is there a >> simple way?? >> > >> Any suggestion would be greatly appreciated! >> > > See the link I posted. > > On Mon, Apr 19, 2010 at 3:23 AM, Kumar Bibek <[email protected]> wrote: > > However, a cheap workaround would be to have this arraylist as a static >> variable of your source activity. This way, you can access this Array List >> from your destination activity >> > > Except that by doing this, you have to make sure the list is actually > valid. If you start Activity A, fill the list, start Activity B, press Home, > wait a while, come back to your app, your app may have been killed since you > started it, the list will be empty, but you will be back in Activity B. If > you don't validate that list and save and restore it somehow, you will run > into trouble trying to access the empty (or null) list. > > > ------------------------------------------------------------------------------------------------- > TreKing - Chicago transit tracking app for Android-powered devices > http://sites.google.com/site/rezmobileapps/treking > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- 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

