Code example for SurfaceHolder

Methods: getSurface

0
        // Step 4: Set output file 
        mMediaRecorder.setOutputFile(ls.getFileDescriptor());
         
        // Step 5: Set the preview output 
        //mMediaRecorder.setPreviewDisplay(mPreview.getHolder().getSurface()); 
        mMediaRecorder.setPreviewDisplay(holder.getSurface());
         
        Log.i(TAG, "Surface valid: "+holder.getSurface().isValid());
         
        // Step 6: Prepare configured MediaRecorder 
        try { 
            mMediaRecorder.prepare();
        } catch (Exception e) {
            Log.d(TAG, "Exception preparing MediaRecorder: " + e.getMessage());
            releaseMediaRecorder(); 
            return false; 
        } 
        return true; 
    }