Search code examples
androidwindow-soft-input-mode

get android:windowSoftInputMode attribute programmatically on Android


I am aware that the android:windowSoftInputMode manifest attribute can be set programmatically using the following method:

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

Is there any way to get this value programmatically? I do not see a corresponding getter method.


Solution

  • Found the solution, there is no 'convenience' get method but you can easily interrogate the window attributes manually:

    int mode = getActivity().getWindow().getAttributes().softInputMode;