title: How to disable Android Soft Keyboard for a particular activity?
body: <p>I have an activity with one EditText where I need to input numbers only.</p>
  
  <p>Now, I have defined the Input Type for my EditText to be number only and have drawn up a pretty keypad for my user to use, however I also need to make sure the soft keyboard doesn't pop up for my user when they click on the EditText.</p>
  
  <p>I have tried hiding the keyboard through the manifest by adding</p>
  
  <pre><code>android:windowSoftInputMode="stateAlwaysHidden"
  </code></pre>
  
  <p>in my Manifest for the particular activity, but this doesn't work for me because as soon as the user clicks on the EditText the keyboard appears again.</p>
  
  <p>I've tried doing the same programmatically like so</p>
  
  <pre><code>activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  </code></pre>
  
  <p>but that doesn't work either. Keyboard appears when the user clicks on the EditText.</p>
  
  <p>The only thing that worked was setting InputType to null for the EditText like so:</p>
  
  <pre><code>EditText.setInputType(InputType.TYPE_NULL);
  </code></pre>
  
  <p>but I cannot use this because it will allow users who have a keyboard attached to their device to input letters and other symbols in the EditText field, while I want everyone to specifically use only the keypad to enter data in the field.</p>
  
  <p>I should also mention that I am currently testing my app under android 2.1, but I would like my solution to work across all versions. Any help would be appreciated. Thanks in advance.</p>