When calling stop()
within my Video Capture activity, on occasion, the software will hang and will not come back to life. Only triggering an ANR by hitting \"Back\
check out this-
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
releaseMediaRecorder();
releaseCamera();
}
private void releaseMediaRecorder(){
if (recorder != null) {
recorder.reset(); // clear recorder configuration
recorder.release(); // release the recorder object
recorder = null;
camera.lock(); // lock camera for later use
}
}
private void releaseCamera(){
if (camera != null){
camera.release(); // release the camera for other applications
camera = null;
}
}
public void stopRecording() { // Toast.makeText(this,"Inside the stop recording",Toast.LENGTH_SHORT).show();
// camera.unlock();
recorder.stop();
// recorder.reset();
recorder.release();#release the recorder after stop important.
}