title: Prevent soft input from appearing
body: <p>I have a Bluetooth barcode scanner attached to Android tablet. Hardware keyboard is disabled in Android setting. This allows me both scanning barcodes and using soft keyboard for typing.</p>
  
  <p>When I scan a barcode, my activity catches all keys as expected. But the soft keyboard appears.</p>
  
  <p>How to prevent the soft keyboard from appearing?</p>
  
  <p>I have tried the followings: </p>
  
  <pre><code>android:windowSoftInputMode=stateHidden
  </code></pre>
  
  <p>or </p>
  
  <pre><code>getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
  </code></pre>
  
  <p>(or <code>stateAlwaysHidden</code>),  </p>
  
  <p>but nothing worked. When the app catches hardware keydown, the soft keyboard appears.</p>