1

I want to get state of android virtual keyboard. How can i know virtual keyboard is open or closed?

I want to use this information in onBackPressed() event.

I have already tried below code but cant get solution.

InputMethodManager inputManager = (InputMethodManager) mContext
                    .getSystemService(Context.INPUT_METHOD_SERVICE);

            Log.i("isAcceptingText","..."+inputManager.isAcceptingText());
            Log.i("isActive","..."+ inputManager.isActive()); 

When keyboard is open it does not run "Log" messages.

KAPLANDROID
  • 1,099
  • 1
  • 12
  • 23

1 Answers1

1

This method use onMeasure(). It checks if activity screen is smaller.

How to check visibility of software keyboard in Android?

Community
  • 1
  • 1
M Kosztolowicz
  • 290
  • 4
  • 11