some time we switch one activity to another activity then if keyboard open in first activity then it also show in second activity.
Hide keyboard android |
Hide Soft Keyboard in Android:
try {InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE);inputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
} catch (NullPointerException e)
{
e.printStackTrace();
} catch (Exception e)
{
e.printStackTrace();
}
On Start Activity Hide Keyboard in Android:
Some time on startup EditText focus and Keyboard should be visible then hide it
<activity android:name="com.database.DataListActivity"
android:windowSoftInputMode="stateHidden" ></activity>
above code write in Manifest file where we define Activity.
Note: If any Issue during Implement this task then Please Comment.
Thank You
No comments :
Post a Comment