Navigation 의 의미
기존 문제점
- exception 에 잘 정돈된 fragment transactions 을 어떻게 할 것인가
- 앱의 여러 위치에 어떻게 deep link 를 만들고 최신화할 것인가
- argument bundle 을 어떻게 안전하게 전달할 것인가
- up and back 이 어떻게 사용자가 원하는 방식으로 동작할 것인가
- 특히 deep link 로 앱에 들어올 경우 back stack 을 어떻게 조절할 것인가
- 기존의 errorprone boilerplate code 를 어떻게 없앨 것인가
- 잘 동작하는지 어떻게 Testing 할 것인가
Navigation 이 할 수 있는 일
- Handling fragment transactions
- Deep linking is a first class operation
- Type safety when passing information while navigating
- Handling up and back correctly by default
- Provides defaults for animations and transitions
- Navigation UI patterns like navigationn drawers and bottom nav with little additional work
- Android Studio offers tooling for visualizing and editing the navigation flow of an app
Navigation 사용
NavHostFragment implements NavHost
a widget that is meant to swap in and out different fragment destinations as you navigate through the navigation graph
NavigationUI(navigation-ui-ktx)
collection of static methods that associate menu items with navigation destinations
destination id를 id로 가진 menu item 을 누를 경우 해당 destination 으로 이동 시켜줌
NavController
NavOptions
Safe Args
Deep Linking
'Android > Android Develop' 카테고리의 다른 글
WorkManager (0) | 2019.07.07 |
---|---|
Android Slice (0) | 2019.07.07 |
Instant App (0) | 2019.07.07 |
Android Notification 개발시 주의사항 (0) | 2019.07.07 |