title: Android: Detect user inactivity / Detect (softkeyboard) keyboard input
body: <p>I want to detect "user inactivity" in my Android app. To be more precise: I want to detect if the user has NOT done any interaction with my app (touching the screen, scrolling, input texts ...) for a specific time. Technically I use a timer that is reseted on each (user) interaction.</p>
  
  <p>In my activity, I override the <em>onUserInteraction</em> method to detect interactions like scrolling, touching the screen ...</p>
  
  <pre><code>@Override
  public void onUserInteraction(){
      resetInactiveTimer();
  }
  </code></pre>
  
  <p>Unfortunately, onUserInteraction is not called when the user interacts with the soft keyboard. I think the reason is, that the soft keyboard is not part of my Activity.</p>
  
  <p>For the edit texts in my app I use <em>TextWatcher</em> and the <em>onTextChanged</em> method which works fine. But my app also contain a WebView that loads arbitrary web pages. Of course some web pages could contain input fields and I do not know how to detect that the user interacts with the soft keyboard to edit those text fields.</p>