Code example for SurfaceHolder

Methods: setSizeFromLayout

0
        private RenderScriptGL mRs;
        private T mRenderer;
        private SurfaceHolder mSurfaceHolder;
 
        @Override 
        public void onCreate(SurfaceHolder surfaceHolder) {
            super.onCreate(surfaceHolder);
            mSurfaceHolder = surfaceHolder;
            setTouchEventsEnabled(false);
            surfaceHolder.setSizeFromLayout();
 
            if (getResources().getBoolean(R.bool.use_32bit)) {
                surfaceHolder.setFormat(PixelFormat.RGBX_8888);
            } 
        } 
 
        @Override 
        public void onDestroy() { 
            super.onDestroy(); 
            destroyRenderer(); 
        }