Is there any way to change android:windowSoftInputMode value from java class?

Prasham picture Prasham · May 26, 2011 · Viewed 58.7k times · Source

I want to act my tabs to have different windowSoftInputMode properties for each tab. How to access this property from java class when all handling of your tab is done from one single activity?

Is there any way to access this manifest property from java code?

Answer

AjOnFire picture AjOnFire · May 26, 2011

Use the following to change the softInputMode for an Activity.

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

Use the following to change the softInput type for an EditText.

mEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);

Thanks to @Eliezer for correction