1

I am trying to add the ability to turn on the LED flash within my app. It's not the app's primary function so I am not trying to capture every single device.

I have added the following code:

    flash_ok = getApplicationContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);

    if(flash_ok){
        torch_image.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mCamera == null){
                   try{
                         mCamera = Camera.open();
                 }catch ( Exception e ){

                }
                if(!torch_is_on){
                    processOnClick();
                }
                else(torch_is_on){
                    processOffClick();
                }
            }
        });
    }

This works just fine on every device I have tested so far (light doesn't light on the original Galaxy Tab but that's not an issue) but causes a force close on the Xoom. I don't have the device in my possession so I can't debug.

Any ideas?

Thanks

EDIT: Okay I have tried the same app on another Xoom and not only did it not crash but the light lit! My only guess is there a problem with the other device's hardware.

4

0 に答える 0