My currently running activity B should be destroyed using ‘finishActivity(999)’. Doing so, I want to get back to the method ‘onActivityResult’ in activity A which called activity B.
This somehow doesn’t work. Below some code snippets:
public class ActivityB extends Activity {
...
// Method listening OnClick event
public void verifyPassword(View view) {
...
// call http server in order to verify password
if (httpResponse != 200) {
finishActivity(999);
}
command Z;
}
I can see that in the debugger that the finishActivity(999) statement is performed, but after that, simply the next instruction ‘command Z’ in the same activiy is executed.
Why does the finishActivity(999) statement has no effect?
finishActivity()doesn’t finish the current activity:Note another activity, not this activity (e.g. you could call it from activity a).
You want just
finish()instead, most likely in combination withsetResult().