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);
});
Try using this and options available.
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
My problem was that when ever my activity started, kepyboard poped up automatically if there is an EditText. So, I used the above in OnCreate(). Try using different options instead of ".SOFT_INPUT_STATE_ALWAYS_HIDDEN"