I\'ve got an EditText widget in my app which I have set to read-only, and I want to know when the user long-presses on it. I don\'t want the virtual keyboard to popup if the
button.setOnLongClickListener (View.OnLongClickListener l(){ //override the method //then do this InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); });