material
material copied to clipboard
Hi have a strange issue, with swich and open keyboard
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.