Hi i won't want to show virtual keyboard even user touch the editText field.
            Asked
            
        
        
            Active
            
        
            Viewed 3,381 times
        
    4 Answers
6
            
            
        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);
 
    
    
        Pointer Null
        
- 39,597
- 13
- 90
- 111
 
    
    
        GeekYouUp
        
- 1,651
- 11
- 10
3
            
            
        As in this question use:
EditText edtView=(EditText)findViewById(R.id.editTextConvertValue);
edtView.setInputType(0);
1
            
            
        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);    
    }
}
 
    
    
        lalosoft
        
- 134
- 6
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;
    }
});
 
    
    
        Keyman Muhia
        
- 13
- 2
 
     
    