you should read develop document more. the application is composed by activities. some activities can form a stack. Only one activity can active.
It does not Like you access a method of another class in java. So why refactoring this method into another class? 2010/6/20 Gaurav Vaish <[email protected]> > Application Context is not an activity but just "Context" (It's actually, > Application) > > > -Gaurav > > > > On Sun, Jun 20, 2010 at 12:01 PM, mike <[email protected]> wrote: > >> hi guys, >> >> i have Activity A and Activity B >> >> i want to access a method in Activity A from Activity B >> >> this is my method >> Activity A extends activity{ >> >> public void save(){ >> >> } >> } >> >> this is what i have done from activity B >> >> Activity B extends activity{ >> >> public void access{ >> >> AcitvityA noti = (AcitvityA) getApplicationContext(); >> noti.save(); >> >> } >> >> } >> >> and i'm getting a runtime exception saying >> >> java.lang.ClassCastException: android.app.Application >> >> >> how can i access this method from another activity?? >> >> regards, >> Mike >> >> -- >> 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 > > > > > -- > > -- > Cheers, > Gaurav Vaish > http://mastergaurav.com > http://twitter.com/mastergaurav > ---------------------------- > > -- > 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

