2

I have just reinstalled Android SDK, Java JDK, and Eclipse Indigo back on to my laptop (after a hardware crash) and now I am getting errors within my android projects relating to the following:

@Override
public void onLocationChanged(Location location) {
    int lat = (int) (location.getLatitude());
    int lng = (int) (location.getLongitude());
    latituteField.setText(String.valueOf(lat));
    longitudeField.setText(String.valueOf(lng));
}

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    // TODO Auto-generated method stub

}

@Override
public void onProviderEnabled(String provider) {
    Toast.makeText(this, "GPS Enabled ",
            Toast.LENGTH_SHORT).show();

}

@Override
public void onProviderDisabled(String provider) {
    Toast.makeText(this, "GPS Disabled ",
            Toast.LENGTH_SHORT).show();
}

Eclipse tells me that I should remove @Override annotation in order to resolve the issue. These errors only seem to be related to android.location methods. I know that before the hardware crash the code worked fine without any errors, so I am not sure what the problem is. If someone could provide some advice, it would greatly be appreciated.

For the reinstall, I used the following:

Eclipse 64bit, Android SDK 32bit, Java JDK 32bit

smithc5
  • 21
  • 3

3 Answers3

3

Please check the JDK version, if it is not 1.6 eclipse gives this error.

Rajdeep Dua
  • 11,190
  • 2
  • 32
  • 22
0

Go to project ->properties->java compiler-> Set compiler compliance level to to 1.6 instead of 1.5 ... Because annotation support in code is provide in 1.6 compiler not in 1.5 compiler.

Mufrah
  • 534
  • 7
  • 22
0

The @Override annotation is used to signify that a method overrides a method in the parent class. It is useful to get compiler errors and other benefits.

If you are getting errors it probably means that you are not extending the superclass correctly or it does not have those methods.

Community
  • 1
  • 1
skynet
  • 9,898
  • 5
  • 43
  • 52