I'm trying to make an app that just gets gps coordinates and displays them. I found that you need to do LocationManager.requestLocationUpdates() in order to get it to work, but this requires you to have an implemented LocationListener as a parameter. I've found tons of sites showing how to do this, and they're all doing it basically the same way, but for some strange reason it won't work for me. Here's my implementation:
Now when I try to run it it gives errors on each of the overridden methods. They're all basically the same. Here's the one for OnLocationChanged:
The method onLocationChanged(Location) of type HelloViaSocket.MyLocationListener must override a superclass method
Everything I've seen says that LocationListener should have OnLocationChanged and all the other methods I'm trying to override, so why is it doing this?
I tried deleting my Google API's from the SDK, and then re-downloading and installing them, but I'm getting the same problem.
Does anyone have any idea what I'm doing wrong?
Bretterson
Code:
private class MyLocationListener implements LocationListener
{
@Override
public void onLocationChanged(Location loc) {
if (loc != null) {
Toast.makeText(getBaseContext(),
"Location changed : Lat: " + loc.getLatitude() +
" Lng: " + loc.getLongitude(),
Toast.LENGTH_SHORT).show();
}
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String provider, int status,
Bundle extras) {
// TODO Auto-generated method stub
}
}
Now when I try to run it it gives errors on each of the overridden methods. They're all basically the same. Here's the one for OnLocationChanged:
The method onLocationChanged(Location) of type HelloViaSocket.MyLocationListener must override a superclass method
Everything I've seen says that LocationListener should have OnLocationChanged and all the other methods I'm trying to override, so why is it doing this?
I tried deleting my Google API's from the SDK, and then re-downloading and installing them, but I'm getting the same problem.
Does anyone have any idea what I'm doing wrong?
Bretterson