I have an Activity with only one EdtiText. When that Activity starts, the EditText is focused and the soft keyboard is shown. This seem to happen after onResume, because when I programmatically hide the keyboard in onResume it doesn't work. When I do this:
@Override
protected void onResume() {
    super.onResume();
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
            //Find the currently focused view, so we can grab the correct window token from it.
            //If no view currently has focus, create a new one, just so we can grab a window token from it
            imm.hideSoftInputFromWindow(etBarcode.getWindowToken(), 0);
        }
    }, 500);
}
it hides it (after popping up shortly).
Is there an event on an EditText I can use to preven the keyboard popping up? Or some other way of preventing it to show?
Update focusableInTouchMode does not do what I want, because when set to true the keyboard pops up, when set to false it is not focusable at all. 
 
     
     
     
    