virtual keyboard

Android EditorInfo Go, Search, Done, Next Example

There is always necessity to add extra keys apart from default keys available in virtual QWERTY keyboard. For instance we may need a direct search key by the side of edit text box in order to have direct triggering of Search actions.
For Instance to add a Search key we need to add this code, so that It may appear in the QWERTY board.

[sourcecode language="java"]
EditTextSample.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
[/sourcecode]

Android Hide Virtual Keyboard through code

In most situation we are in need to force close the keyboard by pressing the back button. But this can also be done using the following code.
[sourcecode language="java"]
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditTextName.getWindowToken(), 0);
[/sourcecode]

This key code forces the keyboard to close.

Syndicate content