diff --git a/library/src/main/java/com/aspsine/fragmentnavigator/FragmentNavigator.java b/library/src/main/java/com/aspsine/fragmentnavigator/FragmentNavigator.java index 3338520..95b9de7 100644 --- a/library/src/main/java/com/aspsine/fragmentnavigator/FragmentNavigator.java +++ b/library/src/main/java/com/aspsine/fragmentnavigator/FragmentNavigator.java @@ -21,7 +21,7 @@ public class FragmentNavigator { @IdRes private int mContainerViewId; - private int mCurrentPosition; + private int mCurrentPosition = -1; private int mDefaultPosition; @@ -125,5 +125,8 @@ private void remove(int position, FragmentTransaction transaction) { public void setDefaultPosition(int defaultPosition) { this.mDefaultPosition = defaultPosition; + if (mCurrentPosition == -1) { + this.mCurrentPosition = defaultPosition; + } } }