Code example for Camera

Methods: reconnectstopPreview

1
			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);
		}		 
	} 
 
	private void BeginPreview(){ 
		if(UserCamera != null && !isPreview){
			UserCamera.startPreview();
			isPreview = true;
		} 
	} 
	private void StopPreview(){ 
		if(UserCamera != null && isPreview){
			UserCamera.stopPreview();
			isPreview = false;
		} 
	} 
} 
Connect your IDE to all the code out there  Get Codota for Java