title: Android, only show custom keyboard
body: <p>I have an application where I needed to create a custom keyboard since barcode scanners are classified as hardware keyboards and hardware keyboards disable soft keyboards. The issue is that when no scanner is connected, the built in soft keyboard will be displayed when it's not needed. I have a button to show the custom keyboard which will also hide the default keyboard using </p>
  
  <pre><code>((InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(advText.getWindowToken(), 0);
  </code></pre>
  
  <p>(advText is an extended version of EditText) </p>
  
  <p>I have tried placing that line of code in the <code>onFocusChanged</code> method of the EditText but nothing happens. If I use <code>setInputType(InputType.TYPE_NULL);</code> the android keyboard never shows, but the EditText doesn't display a cursor or anything that is typed from the custom keyboard (but I do know that keys are being stored since my "done" key sends the text from the EditText elsewhere just fine).</p>
  
  <p>I'm fine with disabling the android keyboard completely for this app, just as long as the EditTexts show cursors and custom keyboard is only shown when using the button.</p>
  
  <p>I have looked at these answers, but no luck finding a solution.</p>
  
  <p><a href="https://stackoverflow.com/q/1109022/711759">Close/hide the Android Soft Keyboard</a></p>
  
  <p><a href="https://stackoverflow.com/q/5105354/711759">How to show soft-keyboard when edittext is focused</a></p>
  
  <p><a href="https://stackoverflow.com/q/8997225/711759">How to hide Android soft keyboard on EditText</a></p>
  
  <p>Edit:</p>
  
  <p>My current solution is to run the hide method inside of the EditText's onCheckIsTextEditor since that seems to run after onFocusChanged, and it seems to be called about every second. But this is a nasty hack since the keyboard still shows for a split second and moves my layouts back and forth. My current test devices consist of the Motorola Photon Q 4G LTE with 4.1.2 and a Honeywell Dolphin 70e Black with 4.0.3</p>