2
I’m new with the platform and I’m having trouble in an app I’m developing, it was working normally on Android 4.0.4 and now that I 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()
; - Configuration of
params
; - Call to
takepicture(null, null, mPicture)
;
I don’t use the surfaceview
, because the app takes pictures 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);
}
}
Can you add a minimum code that can reproduce the problem? (Probably relevant:
isVideoSnapshotSupported()
)– Guilherme Bernal