How do I get back to my previous activity on Android?

Asked 2 years ago, Updated 2 years ago, 124 views

I'd like to make a simple app to return to my previous activity. What code do I need to return to the previous activity?

android android-intent

2022-09-21 16:35

1 Answers

Android activities are stored in the activity stack. So going back to the previous activity means two things.

When you open a new activity using startActivityForResult in another activity. In this case, you can simply call the finishActivity() method from the newly created activity to return to the previous activity.

You want to track the activity stack. In this case, whenever you start a new activity, you can give flags such as FLAG_ACTIVITY_REORDER_TO_FRONT or FLAG_ACTIVITY_PREVIOUS_IS_TOP to the int. You can mix the order between activities by giving these flags.

http://theeye.pe.kr/archives/1298 <- This link will help you to see and refer to the Intent Flag type.


2022-09-21 16:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.