In my app i have 3 activities.
From 1st activity it goes to 2nd and from 2nd it goes to 3rd. From 3rd it is coming to 1st again. and if I press back key from the 1st then it should go to home screen (App will stop).
If I press back key of 1st its goes to 2nd activity again and if I press 2nd’s back key, then it goes to the 1st . Then if I press back key of 1st then app stops.
What I want , when I am in 3rd activity and press the back button then it should go to 1st and simultaneously finish the 2nd activity.
How can I do that?
just finish the second activity when you open third activity
suppose in second activity on some button click you are opening third activity using start activity;
if you want depended on some condition then on activity
something code like this
now when override onActivityResult in second activity
also make sure one thing you need to use startActivityForResult(intent, requestCode); for result in second activity to start third activity.