hi treking, What you have said is the common way to pass arguments to an activity. But my question is about how to pass an object of user defined class to an activity. One guy said that it could be done by implementing some common functions for this activity and calling those functions to pass object to this activity, but how I can get the activity reference would be a problem. As Mark said you can't really do this if you use any of the derived Activity classes (List, Tab, and especially Map). For this kind of "common activity stuff" I created a proxy of sorts - a class that takes an instance of an Activity and implements functions that are common for all. Then each Activity just creates an instance of this proxy with itself and uses it to do the common logic stuff. It's a little more verbose, but works to centralize the common code given the restrictive inheritance hierarchy.
_____ From: [email protected] [mailto:[email protected]] On Behalf Of TreKing Sent: Thursday, December 30, 2010 7:56 AM To: [email protected] Subject: Re: [android-developers] Re: Passing objects to new intents On Tue, Dec 28, 2010 at 11:52 PM, maomaostevencao <[email protected]> wrote: If I want to load a new activity and pass some of arguments using this way, I have to get the reference of this new activity, but seems platform doesn't provide any API to get it. How can you do it? I mean how I can get the reference of the new activity You do not need a reference to the new activity. You launch an intent with the proper variables, then the new activity is launched and within it you use getIntent() to get the Intent that launched it, including any variables you passed along. ---------------------------------------------------------------------------- --------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- 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 -- 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

