android - Update NavigationView state when user goes back to previous fragment -
i'm using navigationview drawer in app. i'm trying go previous fragment if user press button. code works well:
@override public void onbackpressed() { fragmentmanager fm = getsupportfragmentmanager(); fragment fr = fm.findfragmentbyid(r.id.flcontent); if (fm.getbackstackentrycount() > 0 ) { fm.popbackstackimmediate(); } else { finish(); } }
but navigationview doesn't change. how can update navigationview state (check correct fragment, change title, , on), can reflect changes in app?
you should implement navigation using addtobackstack method. take @ this.
Comments
Post a Comment