Hi i won\'t want to show virtual keyboard even user touch the editText field.
Have you tried adding android:configChanges="keyboard|keyboardHidden" into your activity?
e.g.:
<activity android:name=".MyApp" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden">
Not sure if it applies to the onscreen keyboard as well as a physical one.
Also you can mess with the On Screen Keyboard using the InputMethodManager, for example to hide it you could use:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mCurretnView.getWindowToken(), 0);
try this
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
boolean ret = super.dispatchTouchEvent(event);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mCurretnView.getWindowToken(), 0);
return ret;
}
or
editText.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mCurretnView.getWindowToken(), 0);
return false;
}
});
As in this question use:
EditText edtView=(EditText)findViewById(R.id.editTextConvertValue);
edtView.setInputType(0);
InputMethodManager inputMethodManager = (InputMethodManager) currentActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
if (isShow) {
if (currentActivity.getCurrentFocus() == null) {
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
} else {
inputMethodManager.showSoftInput(currentActivity.getCurrentFocus(), InputMethodManager.SHOW_FORCED);
}
} else {
if (currentActivity.getCurrentFocus() == null) {
inputMethodManager.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0);
} else {
inputMethodManager.hideSoftInputFromInputMethod(currentActivity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}