Monday, February 4, 2013

Hide keyboard from activity

If there is no need of keyboard then you can hide by adding following lines in to manifest


<activity
            android:name=".ActivityName"
            android:label="@string/name"
            android:windowSoftInputMode="stateAlwaysHidden" />


Also You can use InputMethodManager, calling hideSoftInputFromWindow


getWindow().setSoftInputMode(
      WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

OR

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

No comments:

Post a Comment