Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6854681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:39:52+00:00 2026-05-27T01:39:52+00:00

I have been following the official Android tutorials and somehow am having a problem

  • 0

I have been following the official Android tutorials and somehow am having a problem with this very simple example to execute a function after pressing “Enter” for an EditText.

I understand what I’m supposed to do and seem to have everything setup properly, but Eclipse is complaining with this line:

edittext.setOnKeyListener(new OnKeyListener() {

It underlines setOnKeyListener with the error:

The method setOnKeyListener(View.OnKeyListener) in the type View is not applicable for the arguments (new DialogInterface.OnKeyListener(){})

And also underlines OnKeyListener with the error:

The type new DialogInterface.OnKeyListener(){} must implement the inherited abstract method DialogInterface.OnKeyListener.onKey(DialogInterface, int, KeyEvent)

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:39:52+00:00Added an answer on May 27, 2026 at 1:39 am

    From what I can see, It looks like you have the wrong import.

    Try

    edittext.setOnKeyListener(new View.OnKeyListener() {
    

    OR add this import

    import android.view.View.OnKeyListener;
    

    and Remove this one

    import android.content.DialogInterface.OnKeyListener;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been following this tutorial for setting up tabs in your application. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
I have been having the following problem, i think it's probably due to the
I am just starting to learn JNI. I have been following a simple example,
I have been following this link Android kernel compile and test with Android Emulator
I have been following the example on the bottom of this page: http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.ribbonapplicationmenu.auxiliarypanecontent.aspx to
I have been following some MVC tutorials that connect to a sql mdf database
Hi I am quite new to php but i have been following some tutorials
I'm new to NHibernate... I have been following this NHibernate Tutorial from Gabriel Schenker
i have been following this course in youtube and it was talking about how
I have been following this tutorial and everything was going nice and easy until

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.