File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
app/src/main/java/com/d4rk/androidtutorials/java/ui/screens/main Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,16 @@ private void navigateToPreferredDestination(int preferredDestination) {
327327 lastPreferredStartDestination = preferredDestination ;
328328 return ;
329329 }
330+ if (!getLifecycle ().getCurrentState ().isAtLeast (Lifecycle .State .RESUMED )) {
331+ getLifecycle ().addObserver (new DefaultLifecycleObserver () {
332+ @ Override
333+ public void onResume (@ NonNull LifecycleOwner owner ) {
334+ getLifecycle ().removeObserver (this );
335+ navigateToPreferredDestination (preferredDestination );
336+ }
337+ });
338+ return ;
339+ }
330340 NavOptions options = new NavOptions .Builder ()
331341 .setPopUpTo (graph .getStartDestinationId (), true )
332342 .setLaunchSingleTop (true )
You can’t perform that action at this time.
0 commit comments