Hiding keyboard after calling new Activity that shows a ProgressDialog

Solved using a variation of the technique posted by phalt:

InputMethodManager im = (InputMethodManager) this.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

This code works correctly during onCreate/onStart/onResume, since doesn't rely on a focused view to get the window token from.


Write this code in manifest.xml file for 'SecondActivity' Activity.

<activity name="EditContactActivity"
    android:windowSoftInputMode="stateAlwaysHidden">
    ...
</activity>