+ Reply to Thread
Results 1 to 2 of 2

Thread: How to hide or dismiss a soft keyboard?

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    17

    How to hide or dismiss a soft keyboard?

    I want to hide or dismiss soft keyboard for my activity please let me know how to do that.

  2. #2
    Junior Member
    Join Date
    Aug 2012
    Posts
    15
    Tell the Input Method Manager explicitly tohide any visible InputMethods using the
    InputMethodManager.hideSoftInputFromWindow()method .check the code

    Code:
    public void onClick(View view) { 
    InputMethodManager imm = (InputMethodManager)getSystemService( 
    Context.INPUT_METHOD_SERVICE); 
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0); 
    }
    Notice the hideSoftInputFromWindow()take an IBinder window token as a parameter.
    This can be retrieved from any View object currently attached to the window via
    View.getWindowToken(). In most cases, the callback method for the specific event will
    either have a reference to the TextView where the editing is taking place, or the View
    that was tapped to generate the event (like a Button). These views are the most
    convenient objects to call on to get the window token and pass it to the
    InputMethodManager.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts