Camera app stopped working when upgrading from Android 4.0.4 to 4.1.2

Asked

Viewed 2,587 times

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);
    }
}

1 answer

1

Sometimes the problem is not the code, but the firmware installation. I solved an identical problem simply giving a 'factory reset' it will remain android 4.1.2 but eliminate all apps, configs and remains of the installation. In my case it worked!

  • Thanks, I will test... just lack courage, I managed using Surface but got much slower... I will test on other devices before restoring... the Portuguese stackoverflow is to congratulations, I thought no one would answer... thanks again

Browser other questions tagged

You are not signed in. Login or sign up in order to post.