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

  • SEARCH
  • Home
  • 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 6054803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:11:38+00:00 2026-05-23T08:11:38+00:00

I am making an Android application, and I have some buttons. I want to

  • 0

I am making an Android application, and I have some buttons.
I want to add some listeners to them, so I have implemented android.view.View.OnClickListener, and added listeners to the buttons.

However, at the onClick method, I can’t add the Override annotation like this:

@Override
public void onClick(View view) { /* With Override */ }

But this works:

public void onClick(View view) { /* Without Override */ }

And if I try to log something in the latter onClick method, it works as intended.

I am using Eclipse, and it keeps telling me that I must override a superclass method.

Why can’t I add the Override annotation to it if I’m overriding it?

I am using Ubuntu 11.4, if that matters. java -version returns:

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

Here is the code:

import android.view.View.OnClickListener;

public class Main extends Activity implements OnClickListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

        Button btnFoo = (Button) findViewById(R.id.btnFoo);
        btnFoo.setOnClickListener(this);
    }

    // @Override
    public void onClick(View v) {
        Log.e("foo", "bar");
    }
}

PS. I’m using Sun JDK 1.6

EDIT:

I’ve found this applies to most of the methods I’m trying to use, e.g public void run() (from Runnable).

  • 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-23T08:11:39+00:00Added an answer on May 23, 2026 at 8:11 am

    you can try to change the java sdk version to 1.6 and will be fix it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making the phonegap android application in html,javascript and jquery.I have made the
I am making an android application in which i have five items in a
I'm making an Android application that has to read some values from a JSON
I am making an android application in which I have put 10 images and
I am making an Android application and I want to encrypt a String before
I am making an HTTP get request to a website for an android application
I'm making an ecommerce application on Android and, as it is my first serious
I have searched through Google, SO and Android developers but I need some further
I want to have my application periodically save a zip file to the cloud.
I want to start making cellphone apps with Android as first choice but not

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.