title: trying to create an own method for onKeyDown event (Android)
body: <p>I have two classes: </p>
  
  <p>MainPanel (where I define some methods)
  MainThread (where I do a loop with these methods to create a classic game structure)</p>
  
  <p>In the MainPanel class I have this method to capture if a key was pressed</p>
  
  <pre><code> @Override 
   public boolean onKeyDown(int keyCode, KeyEvent event) { 
           switch(keyCode) { 
                   case KeyEvent.KEYCODE_DPAD_UP: 
                           Log.i(TAG,"key up was pressed"); 
                           return true; 
           } 
           return false; 
  }
  </code></pre>
  
  <p>It works right, my question is if it's possible to create the onKeyDown as a proper method and use it in the loop to avoid the listener. The idea is to define a method like this in the MainPanel:</p>
  
  <pre><code>public void myOwnOnKeyDown(int keyCode, KeyEvent event) { 
       switch(keyCode) { 
               case KeyEvent.KEYCODE_DPAD_UP: 
                       Log.i(TAG,"key up was pressed");
       }
  }
  </code></pre>
  
  <p>And then, call it into my loop on MainThread Class like this...</p>
  
  <pre><code>public class MainThread extends Thread {
  //...
  
  public void loop() { 
      Canvas canvas; 
      KeyEvent event; Log.d(TAG, "Starting game loop");
  
      while (running) {
  
          this.MainPanel.MyOwnOnKeyDown(keyCode, event); 
          this.MainPanel.moveElements(); 
          this.MailPanel.drawElements(canvas); 
      } 
  }
  </code></pre>
  
  <p>At the following line I don't know how to pass the parameter keyCode...</p>
  
  <pre><code>this.MainPanel.MyOwnOnKeyDown(keyCode, event); 
  </code></pre>
  
  <p>It's possible to that?</p>
  
  <p>Thanks in advance</p>