With this code:
private class WRYLocationListener implements LocationListener
//private class WRYLocationListener extends LocationListener <- I tried this, too, with the same results
{
@Override
public void onLocationChanged(Location loc) {
. . .
I get this err msg:
The method onLocationChanged(Location) of type Activity.WRYLocationListener must override a superclass method.
I got this code from a book; “extends” makes more sense to me here than “implements” (maybe it’s a typo in the book?), but even with “extends” I get the same err msg…
implementsis the only thing that makes sense, becauseLocationListeneris an interface.The
@Overrideannotation for interfaces, however, is a JDK 6 feature, not JDK 5, and should be removed. In JDK 5,@Overrideis valid only if a class overrides a superclass method (as opposed to implementing an interface method).