title: How to get Keyboard isShowing or not Android
body: <p>I want to get state of android virtual keyboard. How can i know virtual keyboard is open or closed?</p>
  
  <p>I want to use this information in onBackPressed() event.</p>
  
  <p>I have already tried below code but cant get solution.</p>
  
  <pre><code>InputMethodManager inputManager = (InputMethodManager) mContext
                      .getSystemService(Context.INPUT_METHOD_SERVICE);
  
              Log.i("isAcceptingText","..."+inputManager.isAcceptingText());
              Log.i("isActive","..."+ inputManager.isActive()); 
  </code></pre>
  
  <p>When keyboard is open it does not run "Log" messages.</p>