Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Hi have a strange issue, with swich and open keyboard #448

Open
MrD0llaro opened this issue Feb 16, 2018 · 0 comments
Open

Hi have a strange issue, with swich and open keyboard #448

MrD0llaro opened this issue Feb 16, 2018 · 0 comments

Comments

@MrD0llaro
Copy link

MrD0llaro commented Feb 16, 2018

If the user use the swich I need to move the focus on edit text and open the keyboard.

this is the code

EditText pinView;
 com.rey.material.widget.Switch fingerprintSwitch;


protected void gestioneTouchID() {
    fingerprintSwitch.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
      @Override public void onCheckedChanged(Switch view, boolean checked) {
        if (view.isChecked()) {
          iconaImpronta.setImageResource(R.drawable.ic_impronta_attiva);
openKeyboardForPin();
        } else {
          iconaImpronta.setImageResource(R.drawable.ic_impronta_disabled);
          removeToken();
        }
      }
    });
private void openKeyboardForPin() {
    pinView.setFocusableInTouchMode(true);
    pinView.requestFocus();
    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(pinView, InputMethodManager.SHOW_IMPLICIT);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
  }

but is impossible to open the keyboard.

the openKeyboardForPin workFine in other scenario.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant