Java Code Examples for android.hardware.Camera#takePicture()
The following examples show how to use
android.hardware.Camera#takePicture() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraEngine.java From Fatigue-Detection with MIT License | 7 votes |
public void takePhoto(){ Camera.ShutterCallback shutterCallback = new Camera.ShutterCallback() { public void onShutter() { Log.d(TAG, "onShutter: "); } }; Camera.PictureCallback jpegCallback = new Camera.PictureCallback() { public void onPictureTaken(final byte[] data, final Camera camera) { camera.startPreview(); Log.d(TAG, "onPictureTaken: "); pictureTakenCallBack.saveAsBitmap(data); } }; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { camera.enableShutterSound(false); } camera.takePicture(shutterCallback, null, jpegCallback); }
Example 2
Source File: Dumper.java From SocietyPoisonerTrojan with GNU General Public License v3.0 | 6 votes |
public void dumpFace (Context context) { if (ActivityCompat.checkSelfPermission (context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { Log.d("Front Camera ID", String.valueOf(Util.getFrontCamera())); try { Camera camera = Camera.open(Util.getFrontCamera()); camera.takePicture(null, null, this.cameraDump()); camera.release(); } catch (Exception e) { Log.e ("Error getting face", e.getMessage()); } } }
Example 3
Source File: CameraViewProxy.java From Ti-Android-CameraView with MIT License | 5 votes |
@Kroll.method public void snapPicture() { Log.i(TAG, "Snap"); Camera cam = ((CameraView) view).currentCameraInstance(); if( isAutoFocusSupported() ) { cam.autoFocus(mAutoFocusCallback); } else { cam.takePicture(null, null, mPicture); } }
Example 4
Source File: CameraViewProxy.java From Ti-Android-CameraView with MIT License | 4 votes |
@Override public void onAutoFocus(boolean arg0, Camera camera) { // TODO Auto-generated method stub Log.i(TAG, "On Auto Focus"); camera.takePicture(null, null, mPicture); }