4

In my app, I have an EditText, with a button to change the keyboard input type. The code:

ToggleCambiarTeclado.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View view) {
        if (ToggleCambiarTeclado.isChecked()) {

            tipoDeTecladoActual = InputType.TYPE_CLASS_NUMBER;
            imagenTeclado.setImageDrawable(getResources().getDrawable(R.drawable.keyboard_numeric));
        } else {
            tipoDeTecladoActual = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
            imagenTeclado.setImageDrawable(getResources().getDrawable(R.drawable.keyboard_querty));

        }
        editNumeroContador.setInputType(tipoDeTecladoActual);
    }
});

It works perfectly in my phone...but my boss has a Samsung, and is not changing the keyboard type in his phone.

I have tried changing it to TYPE_TEXT_VARIATION_NORMAL, TYPE_TEXT_VARIATION_VISIBLE_PASSWORD and YPE_CLASS_TEXT, neither of them are working.

Anyone knows if this is a bug? Any known workaround?

Thank you.

EDIT:

Just realized my boss has TouchPal installed. If he changes the default keyboard to the standard it works perfectly...

Fustigador
  • 6,339
  • 12
  • 59
  • 115

2 Answers2

4

Later Samsung devices have SwiftKey keyboards built in. SwiftKey intentionally decided at some point to ignore Android's InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS.

A workaround is to use InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, which is somewhat hacky, but an unfortunately common workaround.

XML variant: android:inputType="textVisiblePassword"

Tom
  • 6,946
  • 2
  • 47
  • 63
  • 3
    This works on Samsung, but breaks Korean input. With "visible password", the Google Korean keyboard is showing latin symbols only. – Over17 Aug 29 '17 at 15:00
0

Samsung's behave weirdly with most things. I've had this issue before and I seem to recall that changing the input type to email worked like a charm. Give it a try.

vguzzi
  • 2,420
  • 2
  • 15
  • 19