Thursday, October 29, 2015

Fragment transaction can't addToBackstack in Marshmallow

Add this piece of code to the underlying Activity


@Override
public void onBackPressed() {
    if (getFragmentManager().getBackStackEntryCount() > 0 ){
        getFragmentManager().popBackStack();
    } else {
        super.onBackPressed();
    }
}


Reference:

http://stackoverflow.com/a/28322881

No comments:

Post a Comment