I have 2 Activities - A and B. I have a non-static method something() in activity B. I need to call something() in activity A and something() cannot be declared as static. What is the best way to do it?
P.S. -something() doesn't start a new activity.It just performs a random action.
You can do something like this,
If it's shared functionality between more than one Activity, then create a base class for your activities that derives from Activity.
public class BaseActivity extends Activity
{
// here write your common method
}
public class B extends BaseActivity
{
// here you can call the method defined in BaseActivity
}