Of course, there is a better answer on this page , but as a workaround you can use SharedPreferences to send an Activity A message requesting that it also ends.
Activity A:
public class A extends Activity { public static final String CLOSE_A_ON_RESUME = "CLOSE_A_ON_RESUME"; @Override public void onResume(){ super.onResume();
Action C:
public class C extends Activity { private void finishCthenA(){
Please note that this is somewhat risky, since preferences survive reboots, and this can prevent A from starting if, for example, your application is killed before resuming. To get around this, you should also delete the message in A.onCreate ()
source share