Search code examples
google-vr

Is VrPanoramaView a subclass of GvrView?


What I'm trying to do is trap the onCardboardTrigger event from a VrPanoramaView. So I think I can do setGvrView on a GvrActivity. But I can't see how I can do that on a VrPanoramaView. Any thoughts?

activity = new GvrActivity();
activity.setGvrView(panoWidgetView);


Error:(65, 29) error: incompatible types: VrPanoramaView cannot be converted to GvrView

Solution

  • No. As shown in the API documentation, VrPanoramaView extends VrWidgetView. Therefore, you can't set a VrPanoramaView as a GvrView.

    Following the inheritance hierarchy of this components in Android Studio, you can see that both VrPanoramaView and GvrView inherit directly from FrameLayout. In consequence, VrPanoramaView can't extend GvrView.