Android code for close keypad in editText

how to close keypad in android apps
how to hide keyboard in android after use of editText


I used a editText for input number and i assigned editText to editbox1 variable ie

editbox1 = (EditText) findViewById(R.id.editText1);

For Closing or hiding keypad in android used InputMethodManager

add following code for close keyboard in android

//To hide key board
InputMethodManager MyKeboard = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
MyKeboard.hideSoftInputFromWindow(editbox1.getWindowToken(), 0);


Here "MyKeboard" is variable and "editbox1" is name of editText.


For using above code, we have to import following header file

import android.view.inputmethod.InputMethodManager;

One Comment

  1. Great Article...Thanks for sharing the best information.It was so good to read and useful to improve my knowledge as updated one.

    Android Training

    ReplyDelete

Add your comments here

Back to Top