I have a simple piece of code here, but for some reason it is not storing the data. I'm sure it's something stupid, but I can't seem to figure it out. Any help would be greatly appreciated.
private byte[] picture;
public void takePicture(){
Camera camera = Camera.open();
Camera.Parameters parameters = camera.getParameters();
parameters.set("camera-id",2);
camera.setParameters(parameters);
parameters.set("gps-timestamp", "1233744883");
camera.setParameters(parameters);
Log.i("method", "in takePicture()");
camera.takePicture(null, rawCallback, null);
camera.release();
}
PictureCallback rawCallback = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
// TODO Do something with the image RAW data.
Log.i("rawcallback", "in rawcallback");
picture = data;
}
};
When I run the code the Log in the call back is not being called, nor is "picture" saving "data". Any thoughts? I'm trying to take a picture with the front facing camera, could I need something special for that, which I'm not doing?
I also have these permissions
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />