0

what happens to the rest of the code of older activity after starting a new activity? here 'doSomeWork()' is called or not? does startActivity() work as a return statement?

public void method(){
    Intent intent = new Intent(this, newactivity.class);
    startActivity(intent);
    doSomeWork();
}
  • You might want to view this question regarding Action Lifecycle Events: https://stackoverflow.com/questions/8515936/android-activity-life-cycle-what-are-all-these-methods-for – Michael Dougan May 31 '19 at 20:17

1 Answers1

0

here 'doSomeWork()' is called or not?

It will be called immediately. startActivity() is not a blocking call. newactivity will not be started by the time startActivity() returns.

does startActivity() work as a return statement?

No.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491