title: Hiding Android Keyboard after Pressing Back Button
body: <p>I am using this code to hide the keyboard:</p>
  
  <pre><code>InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
                  imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
  </code></pre>
  
  <p>This works well. However, I noticed a bug. If I have initially hidden the keyboard using my phone physical back button, then I called the above method, the keyboard will be shown instead of hidden. In other word, seem like the Android system failed to detect I have hidden the keyboard using back button. Instead of hiding the keyboard, it show the keyboard. How to solve this?</p>