1

I have a number of fragments which have been added (not replaced) one on top of the other. And they have also been added to the back stack expect the first one.

Fragment A -> Fragment B -> Fragment C

Hardware Back Btn press works fine when I am on Fragment B and thus come back to Fragment A. But on Fragment C when i do Hardware Back Btn press, the FIRST time nothing happens and I just get the following log:

W/IInputConnectionWrapper: finishComposingText on inactive InputConnection

After that on the second attempt at Hardware back Btn press, onBackPressed() is called in the activity and Fragment C is popped and Fragment B is visible.

I do have a number of Edit Text wrapper in TextInputLayout on Fragment C but not sure how they could be leading to this behaviour, if at all.

Could someone please help me figure why on first time Hardware back Btn press in Fragment C onBackPressed() is not called and just the above warning?

Thanks

private void navigateToFragment(@NonNull Fragment fragment, boolean addToBackStack, int enterAnim, int exitAnim, int popEnterAnim, int popExitAnim) {
            FragmentManager fragmentManager = getSupportFragmentManager();
            final FragmentTransaction transaction = fragmentManager.beginTransaction();


            transaction.setCustomAnimations(enterAnim, exitAnim, popEnterAnim, popExitAnim);
            transaction.add(R.id.member_address_root, fragment, fragment.getClass().getSimpleName());
            if (addToBackStack){
                transaction.addToBackStack(fragment.getTag());
            }
            transaction.commit();
        }
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sunny
  • 7,444
  • 22
  • 63
  • 104

1 Answers1

2

If you are using android 6.0.0 then this is a known bug and it is fixed in 6.0.1 please follow that link for more details: https://issuetracker.google.com/issues/37069061

Muhammad Saad Rafique
  • 3,158
  • 1
  • 13
  • 21