How to Disable Displaying "Suggestions" on the Soft Keyboard

How to disable displaying suggestions on the Soft Keyboard

When developing for 2.0+, the supposed way is setting android:inputType="textNoSuggestions" (ref).
Unfortunately, suggestions are still shown on HTC Desire 2.2 (and probably other HTC Sense devices as well).

Using android:inputType="textVisiblePassword"will not help as well as the software keyboard by HTC won't allow you to switch languages.

So I stick to android:inputType="textFilter" to disable suggestions.

How can I turn off suggestions in EditText?

It's already described in the link Yoni Samlan posted. You should read the documentation correctly ;)

There is a method called setInputType. All you need is to call it with

edittext.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

how to avoid soft keyboard showing auto correct suggestion?

To stop offering suggestions, add the following attribute to your EditText in XML:

android:inputType="textNoSuggestions"

and/or add multiple types using | as below:

android:inputType="textNoSuggestions | text"

Android: AutoCompleteTextView hide soft keyboard

Use OnItemClickListener. Hope this works :)

AutoCompleteTextView text = (AutoCompleteTextView) findViewById(R.id.auto_insert_meds);

text.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
in.hideSoftInputFromWindow(arg1.getWindowToken(), 0);

}

});

UPDATED

Use this

in.hideSoftInputFromWindow(arg1.getApplicationWindowToken(), 0);

instead of -

in.hideSoftInputFromWindow(arg1.getWindowToken(), 0);


Related Topics



Leave a reply



Submit