Reputation: 1548
I am facing a problem than PictureCallback is never called.
Similar problems on stackoverflow mentioned more complex examples, where we saved a file to system. This simple callback is never called. No matter how much time I give it.
public class InbuiltCamera implements PictureCallback {
private static Camera cameraObject;
public InbuiltCamera() {
cameraObject = openTheCamera();
}
// //////// METHODS/////////////////////
public static Camera openTheCamera() {
Camera object = null;
object = Camera.open();
return object;
}
public static void closeCamera(){
if (cameraObject != null)
cameraObject.release();
}
public void snapIt() {
cameraObject.takePicture(null, null, this);
}
public void onPictureTaken(byte[] data, Camera parameter) {
System.out.println("Hi");
}
}
The problem I am facing is that Hi is never printed. EVER !! ie the call back is never called even if I give it enough time.
Upvotes: 1
Views: 986
Reputation: 729
The way you have implemented camera is not correct .please read the documentation for the proper usage of API. http://developer.android.com/reference/android/hardware/Camera.html
Also i have uploaded a sample camera application for your reference: https://github.com/shrishmv/CameraTest
Hope this helps,
Regards, Shrish
Upvotes: 1
Reputation: 624
Never worked with this, but I feeld like it shouldnt be static allt he way through and onPictureTaken should be @Override
Upvotes: 0