Learn Python


Click to Learn Python3

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!

9 comments:

  1. 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
  2. This comment has been removed by the author.

    ReplyDelete
  3. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. Extratorrent

    ReplyDelete
  4. The blog are the best that is extremely useful to keep.
    I can share the ideas of the future as this is really what I was looking for,
    I am very comfortable and pleased to come here. Thank you very much!
    Free Source Code
    Free Source code For Academic
    Academic Project Download
    Academic Project Free Download
    Freelancer In India

    ReplyDelete
  5. Free Source Code
    This will mainly be used by distance education programs offered by institutes, inorder to enable students to get the academic facilities from any computer connected to the Internet. If you want to read more :- Free Source Code|Free Sourcecode For Academic|Academic Project Download|Academic Project Free Download|Freelancer In India. E-mail :- info@nikhilbhalerao.com ph. no. +91 9423979339 https://nikhilbhalerao.com/. #Academic_Project_Download #Academic_Project_Free_Download

    ReplyDelete
  6. Simply want to say your article is as astonishing. The clearness in your post is just nice and i can assume you are an expert on this subject. Fine with your permission allow me to grab your feed to keep updated with forthcoming post. Thanks a million and please keep up the enjoyable work.apple support berlin

    ReplyDelete
  7. Very enthusiastic article, add so much useful information to me.essay rewriter birmingham

    ReplyDelete