I want to call public method in main activity from other activity. How can I do that?
class MainActivity extends Activity {
public void myMethod() {}
}
If you to have static methods to call from any activity you should have a an Utililty or a Helper Class where you can call the methods staticly from anywhere I don't think that its a good pratice to bee caling static methods on one activyty to another
Here is an Example of an Helper Class
public Class ActivityHelper{
public static void myMethod(Context context){
// If you need to do something with your Context
}
/* and you can create a lot of static methods that you would need to use from any activity or service on your app*/
}