Only allow one instance when navigate with NavController

Add a check before navigating to the destination as it would not add a new instance. class A: AppCompatActivity { fun onCreate(…) { // …While navigating if (navController.currentDestination?.id != desiredDestination?.id) { navController.navigate(desiredDestination) } // …else do nothing } } Callback from NavController: https://developer.android.com/reference/androidx/navigation/NavController#addOnDestinationChangedListener(androidx.navigation.NavController.OnDestinationChangedListener)

Android Jetpack Navigation with ViewPager and TabLayout

Experimented with different approaches to handle TabLayout with Jetpack Navigation. But hit issues like having a full history of switching between tabs multiple times etc. Browsing known Google Android Issues before raising a request for a demo, I found this existing issue. Its status is Closed marked as Intended Behavior with the following explanation: Navigation … Read more

Multi-module Navigation with Architecture Components

This is already a year-long but the library now can support this exact use-case! As of 2.1.0-alpha03, we can navigation through deep link URIs. Instead of adding the features as implementation details to each other, we can leave them unaware between themselves and use deep link navigation. Feature 1 – Detail – build.gradle dependencies { … Read more

Navigation Component prevent to recreate fragment on back press

Of course, we can not prevent calling oncrateView, but there is a simple way. Instead of calling view.loadData() in onCreateView or other lifecycle methods we can call it while initializing ViewModel this article helped me to know ViewModel better 5 common mistakes when using Architecture Components Update: The current navigation component (V 2.3.0) doesn’t support … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)