title: How to hide Android soft keyboard on EditText
body: <p>I have an Activity with some EditText fields and some buttons as a convenience for what normally would be used to populate those fields.  However when we the user touches one of the EditText fields the Android soft keyboard automatically appears.  I want it to remain hidden by default, <strong>unless</strong> the user long presses the menu button.  I have search for a solution to this and found several answers, but so far I can't get them to work.</p>
  
  <p>I have tried the following:</p>
  
  <p>1 - In the onCreate method,</p>
  
  <pre><code>this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  </code></pre>
  
  <p>2 - Also in the onCreate method,</p>
  
  <pre><code>InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(editText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
  </code></pre>
  
  <p>3 - and fIn the Manifest file,</p>
  
  <pre><code>&lt;activity android:name=".activityName" android:windowSoftInputMode="stateAlwaysHidden"/&gt;
  </code></pre>
  
  <p>None of these methods work.  Whenever the user clicks on the EditText field, the soft keyboard appears.  I only want the soft keyboard to appear if the user explicitly shows it by long pressing the menu key.</p>
  
  <p>Why isn't this working?</p>