I\'m developing an Android app using GreenDroid. The application is just for testing atm, so it all it contains is an ActionBar with a refresh button, three tabs, and an act
I m not sure about your question but try like this may be it will work
((MainActivity) activity).textViewSetText();
public void textViewSetText (String value){
tv.setText(value);
}
but your activity have to extends The MainActivity.
Right. If the method is static, which it probably should be if this is your goal, just call it like this:
YourClass.staticMethod(params);
If not, you'll need to create an object for it.
YourClass yourClass = new YourClass(constructorParams);
yourClass.method(params);
That should do it.
If you don't want the other Activity instantiated, then that's not the place for this method. If it's shared functionality between more than one Activity, why not create a base class for your activities that derives from Activity.
public class ActivityBase extends Activity
{
public void showToast()
{
...
Then your activities derive from this
public class MyActivity extends ActivityBase
{
public void someMethod()
{
showToast();
In addition to the static method, you can not call any methods which in another activity!