0

I'm writing a process for the user to choose his country. I've an edittext linked to adapter which showing all available options.

In my manifest i set the the activity to
android:windowSoftInputMode="stateAlwaysHidden"

I need to disable the soft keyboard completely.

It works fine except in one condition. if the user perform a long click/press on the editText the keyboard is popping.

Is there a way to permanently disable the keyboard in a specific activity by using code or in the manifest?

my code:

editCountry.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                picker = CountryPicker.newInstance(getString(R.string.select_counrty));
                picker.show(getSupportFragmentManager(), "COUNTRY_PICKER");
                picker.setListener( new CountryPickerListener() {
                    @Override
                    public void onSelectCountry(String name, String code) {
                        editCountry.setText(name);
                        picker.dismiss();
                    }
                });
            }
        });

my manifest:

 <activity android:name=".UserSettingPref"
         android:screenOrientation="portrait"

            android:windowSoftInputMode="stateAlwaysHidden" >

Thanks

Suraj Makhija
  • 1,376
  • 8
  • 16

1 Answers1

0
InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(editText.getWindowToken(), 0);

use following code to disable the OnScreen Keyboard.

Manojkanth
  • 1,071
  • 11
  • 27