This concept comes from the book* Unlocking Android*.
http://www.manning.com/ableson/
Create an object for your your application that extends the
android.app.Application class

*import android.app.Application;
public class MyApplication extends Application {
...
}
*
Provide access to ClassA in the MyApplication class.
Set and Get ClassA from your activities.

*   MyApplication  application = (MyApplication) getApplication();
   ClassA local=application.getClassA();*


>From the FAQ: http://developer.android.com/guide/appendix/faq/framework.html
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.

Carmen

http://twitter.com/CarmenDelessio

http://www.talkingandroid.com

On Tue, Jul 14, 2009 at 9:22 PM, Mapara,Harshit Nitinkumar <
[email protected]> wrote:

>
> Hi All,
>
> Let say I have one class :
>
> Class A {
>    int id; String name;
>    public A(int id, String name) { this.id = id; this.name = name;}
>  }
>
> How do I pass object of A between two Activity classes in a same
> application ?
> I came across the Parcelable interface, but I couldn't find good
> example.
>
> Thanks
> Harshit
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to