How to open soft keyboard ontouchListener of EditText
I have an edittext to which I have assigned a touch listener. But when I touch the editText the soft keyboard does not pop up. I have used InputMethodManager manager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); manager开发者_运维百科.showSoftInput(roomLnEditTxt, InputMethodManager.SHOW_IMPLICIT);
but still not working.
Use SHOW_FORCED instead of SHOW_IMPLICIT
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(YOUR_VIEW, InputMethodManager.SHOW_FORCED);
This will definitely solve your problem.
Add this line in the manifest
<activity android:name=".activity" android:configChanges="keyboardHidden|orientation">
public boolean onTouch(View v, MotionEvent event) {
//your code here
//Return false is the trick
return false;
Returning false solved the problem for me .
精彩评论