Sponser

create your own banner at mybannermaker.com!

Monday, November 7, 2011

Show or Hide soft keyboard on opening a dialog or activity in android

For showing the soft keyboard on entering into the activity or to the dialog we can use this coding


Java


InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);



and for hiding the keyboard



Java

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(singleedittext.getWindowToken(),0);



Have a nice day!

2 comments:

  1. I hope you have a nice day! Very good article, well written and very thought out. I am looking forward to reading more of your posts in the future.teddy bears for babies

    ReplyDelete
  2. Well, I have used the same code but still I am unable to fire the event. I have called that statements on button click event.

    ReplyDelete

Sponser