Note that there are some explanatory texts on larger screens.

plurals
  1. POKeyboard doesn't accept first character when changing inputs
    primarykey
    data
    text
    <p>I have a TextWatcher set on an EditText that changes the input type after a user types a number followed by a space. </p> <p>If the user types two numbers the input type switches and accepts the next character, but if the user types only one number and presses space the input type still changes but it won't accept the first character the user tries to input.</p> <p>I've tested this on Froyo and 1.6, it only happens on Froyo, 1.6 works like it should.</p> <p>Here's the code: </p> <pre><code> TextWatcher watcher = new TextWatcher() { @Override public void afterTextChanged (Editable s) { } @Override public void beforeTextChanged (CharSequence s, int start, int count, int after) { } @Override public void onTextChanged (CharSequence s, int start, int before, int count) { // Parsed text holder is a class that just parses the EditText and pulls out various parts. ParsedTextHolder th = parseTextHolder(s); String newText = ""; Boolean setTextKeyListener = false; String tGetTextString = mQuery.getText().toString(); if (!th.pFullMatch.equals("")) { if (th.pFullMatch.length() == 2) { mQuery.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.SENTENCES, true)); newText = tGetTextString + " for "; setTextKeyListener = true; } } if (setTextKeyListener) { Log.i("setTextKeyListener", "true"); if (mQuery.getKeyListener().getClass() != TextKeyListener.class) { mQuery.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.SENTENCES, true)); } else { Log.d("setTextKeyListener", "skipped. already was text."); } if (!newText.equals("")) { int position = newText.length(); String ttext = newText; newText = ""; mQuery.setText(ttext, TextView.BufferType.EDITABLE); mQuery.setText(ttext); Editable text = mQuery.getEditableText(); Log.w("setting selectiont to text: ", text.toString()); Log.w("setting selectiont to position: ", Integer.toString(position)); Selection.setSelection(text, position); mQuery.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.SENTENCES, true)); } } } }; </code></pre> <p>Also, here's an APK if you want to see what the bug is like: <a href="http://endlesswhileloop.com/files/KeyboardBug.apk" rel="nofollow noreferrer">http://endlesswhileloop.com/files/KeyboardBug.apk</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload