Saturday, June 19, 2010

[android-developers] Accessing Common methods among activities

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate