title: Android: How can I handle the press of the keys?
body: <p>I want to get a key pressing time, in milliseconds.</p>
  
  <p><code>Example</code> if User press 'F' key i want to get the value in milliseconds of the pressing time.</p>
  
  <pre><code> public void keyPressed(KeyEvent event) {
      int keyCode = event.getKeyCode();
      switch (keyCode) {
          case KeyEvent.ACTION_DOWN:
              // start timer
              inizio = System.currentTimeMillis();
              break;
          case KeyEvent.ACTION_UP:
              // end timer
             long  diffInSec = (System.currentTimeMillis() - inizio);
              Toast.makeText(this, "Click durato " + diffInSec, Toast.LENGTH_SHORT).show();
              break;}
  </code></pre>