Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to override methods of LocationListener class

I want to get current location using GPS.

Here is my scenario. My class definition is:

public class UseGps extends Activity implements LocationListener

If Í try to override the LocationListener methods like this

1)

@Override 
public void onLocationChanged(Location loc)

2)

@Override
public void onProviderDisabled(String provider)

3)

@Override
public void onProviderEnabled(String provider)

it is giving me compilation error saying

The method onStatusChanged(String, int, Bundle) of type UseGps must override a superclass method remove override.

Same for 2) and 3)

What is wrong here?

like image 369
manju Avatar asked Dec 07 '22 23:12

manju


1 Answers

Assuming that you are using Eclipse do the following to ensure that your compliance level is 1.6.

Go to Project -> Properties -> Java Compiler. There make sure that Compiler compliance level is set to 1.6.

You should set that level as a default value by navigating to Window -> Preferences -> Java -> Compiler. Select 1.6 for Compiler compliance level.

like image 51
Octavian A. Damiean Avatar answered Dec 18 '22 19:12

Octavian A. Damiean