0

I have cordova application which loading the html pages from web. Now these web pages have input fields, so when click on these input fields android default keyboard appear. I dont want to use this keyboard as already have customize keyboard as popup in side application. What i try: add following configuration inside my activity in androidManifest.xml

  <activity
        android:name=".MainActivity"
        android:screenOrientation="sensorLandscape"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustResize|stateHidden"
       android:configChanges="keyboardHidden|orientation|screenSize">

But nothing can stop appearing this default keyboard. Can someone suggest me how to disable keyboard for my application only.

2 Answers2

0

You need to add this line in Manifest.

 <activity android:name=".MainActivity" 
              android:windowSoftInputMode="stateHidden" />

Look at this answer.

Community
  • 1
  • 1
emin deniz
  • 439
  • 5
  • 13
  • Sorry it is not working even with that.. here is a change in Manifest: –  Mar 09 '16 at 12:05
  • it can be work if android application using EditText. I tried to remove focus on input fields of a webpage and its work but as i am browsing different webpage so i cant remove focus on input on each page so that i am looking something inside my android application. –  Mar 09 '16 at 12:27
0

Not a good way but works:

 @Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    super.dispatchTouchEvent(ev);
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            InputMethodManager inputManager = (InputMethodManager)
                    getSystemService(Context.INPUT_METHOD_SERVICE);

            inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }, 100);
    return true;
}