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;

6 Comments

  1. Excellent Blog. I really want to admire the quality of this post. I like the way of your presentation of ideas, views and valuable content. No doubt you are doing great work. I’ll be waiting for your next post. Thanks .Keep it up! Kindly visit us @
    Christmas Gift Boxes | Wallet Box
    Perfume Box Manufacturer | Candle Packaging Boxes | Luxury Leather Box | Luxury Clothes Box | Luxury Cosmetics Box
    Shoe Box Manufacturer | Luxury Watch Box

    ReplyDelete
  2. Wow, what an awesome spot to spend hours and hours! It's beautiful and I'm also surprised that you had it all to yourselves!
    Kindly visit us @ Best HIV Treatment in India | Top HIV Hospital in India
    HIV AIDS Treatment in Mumbai | HIV Specialist in Bangalore
    HIV Positive Treatment in India | Medicine for AIDS in India

    ReplyDelete

Add your comments here

Back to Top