rob rob - 9 months ago 80
Android Question

Disable back button in VrVideoView Cardboard-Mode in Android SDK

I'm developing an Android app for a controlled environment in which the user should not be allowed to exit the VrVideoView's full screen cardboard mode.

By entering the cardboard mode the SDK seems to present its own activity so I cannot simply override on onBackPressed.

Is there a way to prevent this?

Answer Source

By poking around in the innards you can get your hands on the dialog (yes, it's a dialog) and disable the back button:

vrView = (VrVideoView) findViewById(R.id.videoView);
vrView.fullScreenDialog.setCancelable(false);