public void createVrToast(View toastView) { // Find how big the toast wants to be. toastView.measure(0, 0); toastView.layout(0, 0, toastView.getMeasuredWidth(), toastView.getMeasuredHeight()); Log.v(TAG, "toast size:" + toastView.getWidth() + "x" + toastView.getHeight()); toastTexture.setDefaultBufferSize(toastView.getWidth(), toastView.getHeight()); try { Canvas canvas = toastSurface.lockCanvas(null); toastView.draw(canvas); toastSurface.unlockCanvasAndPost(canvas); } catch { Log.e(TAG, "lockCanvas threw exception"); } nativePopup(appPtr, toastView.getWidth(), toastView.getHeight(), 7.0f); }