Camera reconnect - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Camera reconnect method.

This code example shows how to use the following methods:reconnect, release, stopPreview
	} 
 
	public void stopRecording() { 
		Toast.makeText(getBaseContext(), "Recording Stopped", Toast.LENGTH_SHORT).show();
		try { 
			mServiceCamera.reconnect();
		} catch (IOException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
		mMediaRecorder.stop();
		mMediaRecorder.reset();
		 
		mServiceCamera.stopPreview();
		mMediaRecorder.release();
		 
		mServiceCamera.release();
		mServiceCamera = null;
	} 
} 

6
CodeRank
This code example shows how to use the following methods:reconnect, release, stopPreview
	 
	public synchronized void stop() { 
		super.stop(); 
		if (camera != null) {
			try { 
				camera.reconnect();
			} catch (Exception e) {
				Log.e(TAG,e.getMessage()!=null?e.getMessage():"unknown error");
			} 
			camera.stopPreview();
			try { 
				camera.release();
			} catch (Exception e) {
				Log.e(TAG,e.getMessage()!=null?e.getMessage():"unknown error");
			} 
			camera = null;
		} 
	} 
 
	// Don't forget to deal with the RuntimeExceptions ! 
5
CodeRank
This code example shows how to use the following methods:reconnect, release, stopPreview
	 
	public synchronized void stop() { 
		super.stop(); 
		if (camera != null) {
			try { 
				camera.reconnect();
			} catch (Exception e) {
				Log.e(TAG,e.getMessage()!=null?e.getMessage():"unknown error");
			} 
			camera.stopPreview();
			try { 
				camera.release();
			} catch (Exception e) {
				Log.e(TAG,e.getMessage()!=null?e.getMessage():"unknown error");
			} 
			camera = null;
		} 
	} 
 
	// Don't forget to deal with the RuntimeExceptions ! 
5
CodeRank
This code example shows how to use the following methods:reconnect, release, stopPreview
	} 
 
	public void disable() { 
		Log.e("recorder", "disable");
		stop(); 
		camera.stopPreview();
		camera.release();
		camera = null;
		if (socket != null) {
			try { 
				socket.close();
			} catch (IOException e) {
				e.printStackTrace();
			} 
			socket = null;
		} 
		hideButton(); 
	} 
 
	protected boolean recording = false;

5
CodeRank
This code example shows how to use the following methods:reconnect, release, stopPreview
mVideoRecorder.release();
      mVideoRecorder = null;
    } 
    if (mCamera != null) {
      mCamera.reconnect();
      mCamera.stopPreview();
      mCamera.release();
      mCamera = null;
    } 
    try { 
      mCamera = getCameraInstance();
      if (mCamera == null) {
        if (D)
          Log.e(TAG, "There was a problem opening the camera. ");
        // TODO email devs? 
        beginRecordingAudio(); 
        return; 
      } 
 
5
CodeRank
This code example shows how to use the following methods:reconnect, stopPreview
			mediaRec.stop();
			isRecord = false;
			mediaRec.release();
			mediaRec = null;
			try { 
				UserCamera.reconnect();
			} catch (IOException e) {
				Log.e(tag, e.toString());
			} 
			StopPreview(); 
			TimerTask task = new TimerTask() {
				@Override 
				public void run() { 
					BeginPreview(); 
				} 
			}; 
			Timer timer = new Timer();
			timer.schedule(task, 5 * 1000);
		}		 
	} 

5
CodeRank
This code example shows how to use the following methods:reconnect
 
    public void enableFlash(String flashMode) throws IOException {
        configManager.enableFlash(flashMode);
 
        if (camera != null) {
            configManager.setDesiredCameraParameters(camera);
            camera.reconnect();
        } 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:reconnect, startPreview
	public void stopRecording() { 
		mediaRecorder.stop();
		mediaRecorder.release();
 
		try { 
			camera.reconnect();
		} catch (IOException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
 
		camera.startPreview();
	} 
 
	/** 
	 *  
	 * @param camera 
	 *            the camera to set 
	 */ 
	public void setCamera(Camera camera) {
4
CodeRank
This code example shows how to use the following methods:reconnect, startPreview
	public void stopRecording() { 
		mediaRecorder.stop();
		mediaRecorder.release();
 
		try { 
			camera.reconnect();
		} catch (IOException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
 
		camera.startPreview();
	} 
 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see android.view.View.OnClickListener#onClick(android.view.View) 
	 */ 
	@Override 
4
CodeRank
This code example shows how to use the following methods:reconnect, unlock
	private void prepareRecorder() { 
        recorder = new MediaRecorder();
		recorder.setPreviewDisplay(holder.getSurface());
		 
		if (usecamera) {
			camera.unlock();
			recorder.setCamera(camera);
		} 
		 
		recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
		recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
 
		recorder.setProfile(camcorderProfile);
 
		// This is all very sloppy 
		if (camcorderProfile.fileFormat == MediaRecorder.OutputFormat.THREE_GPP) {
        	try { 
				File newFile = File.createTempFile("videocapture", ".3gp", Environment.getExternalStorageDirectory());
				recorder.setOutputFile(newFile.getAbsolutePath());
			} catch (IOException e) {

4
CodeRank
reconnect Method Overview
Reconnects to the camera service after another process used it.
See Code Examples for other Android Camera Methods: