0

I have been searching the 'net for a bit here, I can't seem to stop the SoftKeyboard from appearing when an EditText gets focus, I've tried at least 3 different methods, setting the Input Type to None (think I saw that in the Android Dev Docs), and two different ways inside the onCreate method, they are:

getWindow().requestFeature(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

And

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

I know I can disable it for the entire app in the manifest file, but I only need it disabled in this activity.

Timbermar
  • 413
  • 6
  • 18

2 Answers2

3

Nothing to do more just place below code in your manifest.xml for perticular activity...

android:configChanges="orientation|keyboardHidden" android:windowSoftInputMode="adjustResize|stateHidden"

Manoj Bhadane
  • 497
  • 5
  • 10
-1

for this one whenever u want key board at that only u write soft keyboard appear,likebelow code

EditText EditTextName=findViewById(R.id.EditText01);
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(EditTextName), 0);

In above code i am enable the keyboard when edittext has focus.In the same way u disable the keyboard using

((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInput(EditTextName), 0);
Pinki
  • 20,511
  • 14
  • 53
  • 86