title: Android execute function after pressing "Enter" for EditText
body: <p>I have been following the official Android tutorials and somehow am having a problem with <a href="http://developer.android.com/resources/tutorials/views/hello-formstuff.html#EditText" rel="nofollow noreferrer">this very simple example</a> to execute a function after pressing "Enter" for an EditText.</p>
  
  <p>I understand what I'm supposed to do and seem to have everything setup properly, but Eclipse is complaining with this line:</p>
  
  <pre><code>edittext.setOnKeyListener(new OnKeyListener() {
  </code></pre>
  
  <p>It underlines <code>setOnKeyListener</code> with the error:</p>
  
  <blockquote>
    <p>The method setOnKeyListener(View.OnKeyListener) in the type View is not applicable for the arguments (new DialogInterface.OnKeyListener(){})</p>
  </blockquote>
  
  <p>And also underlines <code>OnKeyListener</code> with the error:</p>
  
  <blockquote>
    <p>The type new DialogInterface.OnKeyListener(){} must implement the inherited abstract method DialogInterface.OnKeyListener.onKey(DialogInterface, int, KeyEvent)</p>
  </blockquote>
  
  <p>Perhaps someone can shoot me in the right direction? Before I try other solutions (which I've already found on stackoverflow), I'd really like to figure this out because it has me flustered that something so simple to follow, as an official tutorial, doesn't seem work.</p>