Android How to - Hide Input Panel








Question

We would like to know how to hide Input Panel.

Answer

/*w  w w.  ja  v  a  2  s.  c  o m*/
import android.app.Activity;
import android.view.inputmethod.InputMethodManager;


public class Main {
  public static void hideInputPanel(Activity activity) {
    InputMethodManager  imm  = (InputMethodManager)activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
    if(imm.isActive()) {
      imm.hideSoftInputFromWindow(activity.getCurrentFocus().getApplicationWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS );
    }
  }
}