I am new to Android development.
I have created a main Activity (->A), which has 4 buttons. One of the 4 buttons is the EXIT-button.
I start another activity (->B), on click of the EXIT-button. This opens 'B'Activity via an intent from 'A'Activity.
Activity 'B' contains - Do you want to exit? Yes-Button & No-Button.
If I give finish(), onclick of the button - it exits the 'B'Activity. I want to finish 'B' & 'A'.
I have even tried A.finish() -> this doesn't get recognized and results in syntax/semantic error.
I would appreciate help here.
P.S : I am using Android-2.2 version phone, and I do not like to use ActivityManager to resolve this.
use
startActivityForResult()
in Activity A for start activity B andonActivityResult()
in A justfinish()
Activity A. In Activity B on Button pressed justfinish()
Activity B.Try to launch child activity with
In child activity
In parent activity
You can finish parent activity from child activity like...
In Parent....
And override the OnActivityForResult(...) method in Parent .
When you call finish() on child activity, it finishes parent also.