I'm new to the platform and I'm having trouble with an app I'm developing, it was running normally on Android 4.0.4 and now that I've upgraded to 4.1.2 the following message is displayed:
02-27 10:14:47.923: E/Camera_ControlThread(156): Taking picture when recording is not supported!
Soon after the update the following items stopped working:
- Start camera with
Camera.open()
; - Configuring
params
; - Called to
takepicture(null, null, mPicture)
;
I do not use surfaceview
because the app takes photos in real time.
the code is this
Camera camera;
public Cam cam;
protected void onCreate(){
cam = new Cam();
camera = cam.getCameraInstance(getApplicationContext(), cam.idCameraFrontal());
}
PictureCallback jpeg = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
new ThreadProcessamento(data);
processando = true;
}
};
public class ThreadFoto implements Runnable{
Thread t;
public ThreadFoto(){
t = new Thread(this,"video");
t.setPriority(10);
t.start();
}
public void run(){
sairThread = false;
int count = 0;
do{
if(cam.checkCameraHardware(getApplicationContext())){
try{
if(!processando && !bCapturar){//!processando &&
camera.takePicture(null, null, jpeg);
}
}catch(Exception e){
Log.v("ri","ThreadFoto.Exception:"+e.getMessage());
}
log = "Foto tirada: "+count;
}else{
log = "Hardware desativado:"+count;
}
try {
Thread.sleep(200);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ihc.update();
count++;
}while(!sairThread);
}
}