开发者

onPictureTaken function the light is automatically go down

I've run into such a problem. The problem is that when I use onPictureTaken function the light is automatically go down. What should I do with it? I want the light not to turn off.

Photo :

                if (v == shot) 

                    { 
                  camera.takePicture (null, null, null, this); 
                     } 

flashlight:

                  if (prefs.getBoolean (getString (R.string.torch), false)) 
                    { 
    Parameters params = camera.getParameters (); 
                 params.setFlashMode (Parameters.FLASH_MODE_TORCH); 
                 camera.setParameters (params); 
                    } 


@O开发者_StackOverflow社区verride
 public void surfaceCreated(SurfaceHolder holder)
{



 try
 {

         camera.setPreviewCallback(this);
         camera.setPreviewDisplay(holder);
         Camera.Parameters p = camera.getParameters();
         p.setPictureSize(1024, 768);
         p.setPictureFormat (PixelFormat.RGB_565);
         camera.setParameters(p);


 }
 catch (IOException e)
 {
     e.printStackTrace();
 }




 LayoutParams lp = preview.getLayoutParams();



 if (this.getResources().getConfiguration().orientation != Configuration.UI_MODE_TYPE_CAR)
 {

     camera.setDisplayOrientation(90);

 }
 else
 {

     camera.setDisplayOrientation(0);

 }

 preview.setLayoutParams(lp);
 camera.startPreview();






return;

 }




   @Override
protected void onPause()
{

 if (camera != null)
 {
     camera.setPreviewCallback(null);
     camera.stopPreview();
     camera.release();
     camera = null;


 }
 super.onPause();

return ;
   }


protected void onResume()
  {


 super.onResume();
 camera = Camera.open();
  }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜