How to block virtual keyboard while clicking on edittext in android
+3
A:
Here is a website that will give you what you need.
As a summary, it provides links to InputMethodManager
and View
from Android Developers. It will reference to the getWindowToken
inside of View
and hideSoftInputFromWindow()
for InputMethodManager
A better answer is given in the link, hope this helps.
EDIT
From the link posted above, here is an example to consume the onTouch event:
editText_input_field.setOnTouchListener(otl);
private OnTouchListener otl = new OnTouchListener() {
public boolean onTouch (View v, MotionEvent event) {
return true; // the listener has consumed the event
}
};
Here is another example from the same website. This claims to work but seems like a bad idea since your EditBox
is NULL
it will be no longer an editor:
MyEditor.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
int inType = MyEditor.getInputType(); // backup the input type
MyEditor.setInputType(InputType.TYPE_NULL); // disable soft input
MyEditor.onTouchEvent(event); // call native handler
MyEditor.setInputType(inType); // restore input type
return true; // consume touch even
}
});
Hope this points you in the right direction
Anthony Forloney
2009-12-04 07:00:06
thnxs for ur help.Its working
deepthi
2009-12-11 11:24:10
good im glad i could help :)
Anthony Forloney
2009-12-11 14:48:43