Android examples for Camera:Back Camera
Sets the given callback object on the given camera.
//package com.java2s; import java.lang.reflect.Method; import android.hardware.Camera; public class Main { static Method setPreviewCallbackWithBufferMethod; public static boolean setPreviewCallbackWithBuffer(Camera camera, Camera.PreviewCallback callback) { if (setPreviewCallbackWithBufferMethod == null) { camera.setPreviewCallback(callback); return false; }//from w w w .ja va 2 s.c om try { setPreviewCallbackWithBufferMethod.invoke(camera, callback); return true; } catch (Exception ignored) { camera.setPreviewCallback(callback); return false; } } }