1

I can't figure out what is going on with this. Nothing I do seems to work. Basically I get three errors, all from the same strange occurence. My activity will not implement the map change listeners from google maps.

For the first part of the code

public class BarreChat extends AppCompatActivity implements
    OnCameraMoveStartedListener,
    OnCameraMoveListener,
    OnCameraMoveCanceledListener,
    OnCameraIdleListener,
    OnMapReadyCallback {

The block of listeners are all underlined in red saying, Class BarreChat must either be declared abstract or implement abstract method onCameraMoveCanceled() in onCameraMovedCanceledListener

It's not just onCameraMoveCanceled that does this. None of the listeners work except for OnCameraIdle and OnMapReadyCallback.

So... I implement the method within my activity class BarreChat.

@Override
public void OnCameraMoveCanceled() {
    callCloudLogic();
}

And set the listener under onMapReady() miniMap.setOnCameraMoveCanceledListener(this);

But here, @Override is underlined in red with the error message Method does not inherit from its superclass. But how can that be? From Googlemap's own documentation for map listeners this was the proper method.

So I even tried this...

    miniMap.setOnCameraMoveStartedListener(new GoogleMap.OnCameraMoveStartedListener(){
        @Override
        void OnCameraMoveStarted(int i) {
            callCloudLogic();
        }

        });

But with this I get several more red lined error messages in Android Studio. The first is GoogleMap.setOnCameraMoveStartedListener() which reads

Class 'Anonymous class derived from OnCameraMoveStartedListener()' must either be declared abstract or implement abstract method 'OnCameraMoveStarted(int) in OnCameraMoveStartedListener()

Frustrating, because it is declared right below. But... the @Override contains the same message as it does in the BarreChat class...

Method does not override from its superclass.

Can someone tell me what is going on here and how I can fix it? I thought I have properly overriden these methods to implement this onclick functionality but clearly not since it's still broken.

Now, the documentation uses these under an extension of fragment class. I'm not sure if that would do anything... I'm using Google Map as a view, not a fragment, under my main activity. So maybe there is something there...

chrisdottel
  • 1,053
  • 1
  • 12
  • 21
  • I'm still not sure what is going on. But I created the map in another project and it worked. For some reason this code is just messed up... It's not a huge drag to rewrite it. I was thinking that I should probably run Google Maps in a fragment rather than the main UI activity. Still, I don't know why this error occurs since it very clearly is in the right package and all the names are listed correctly. – chrisdottel Jun 28 '18 at 12:48

0 Answers0