Skip to content

onSelected() Not reliably called on Android Nougat  #171

Closed
@ahclipse

Description

@ahclipse

Hello,

First off thanks for the library, it looks great! I think I have found an issue affecting only Android 7.X Nougat devices.

Scenario

  • The first Fragment in my stepper has an EditText field that needs focus and to display a soft keyboard when user navigates to it.

My code to accomplish this looks like:

@Override
public void onSelected() {
    templateNameEditText.post(new Runnable() {
        @Override
        public void run() {
            templateNameEditText.requestFocus();
            InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.showSoftInput(templateNameEditText, InputMethodManager.SHOW_IMPLICIT);
        }
    });
}

This is working wonderfully on every android device down to Android 4.4 KitKat but inconsistently on Android 7.X.

Suspected Cause

  • Line 774 in onUpdate(...) of StepperLayout.java has Step step = mStepAdapter.findStep(newStepPosition); and I have seen only on Nougat devices that this method is sometimes returning null

Steps to Reproduce

  • Add a Fragment that implements Step
  • Add a Log statement or line of code to attach debugger in @Override public void onSelected() {}
  • Verify onSelected is not called on every navigation to Fragment

Expected Result

  • mStepAdapter.findStep(newStepPosition); should not be null and onSelected should be called each time user navigates to Fragment on Android Nougat devices

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions