简体   繁体   中英

What is equivelant of Unwind segue in Android Development

I am used to IOS development and there are unwind segues in Swift to exit to a certain view controller from the present view controller.

(If there is any) What is equivelant of Unwind segue in Android Development? What should I do to go back to a certain activity?

This is handled in onBackPressed() of your Activity, which you can override if you want to do anything special. If you want finer control or more detail, you can read up on FragmentManager , which manages the backstack. popBackStack() and popBackStackImmediate() may be what you're looking for. Generally you shouldn't have to micromanage this too much. By default it'll take you back to the previous activity with no effort on your part.

One thing to take note of as an iOS dev jumping into Android, is there's a difference between back (the button at the bottom), and up (the button in the toolbar up top). The back button takes you back to the previous screen you saw(even to other apps), closes the keyboard, or dismisses certain windows. The up button basically returns you to the main screen of the app, popping the whole backstack. There's some fine points here, which Google does an excellent job explaining in the design guidelines .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM