I am using the camera API and flash mode as torch but after taking one picture the flash is turning off.How can i turn on the flash again.?I am using android 2.3,How can I use flash mode as torch
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // <15>
camera = Camera.open();
params = camera.getParameters();
List<Size> sizes = params.getSupportedPictureSizes();
Camera.Size size = sizes.get(0);
params.setFocusMode(Camera.Parameters.FOCUS_MODE_MACRO);
params.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);
params.setSceneMode(Camera.Parameters.SCENE_MODE_LANDSCAPE);
params.setFlashMode("torch");
params.setJpegThumbnailQuality(100);
params.setExposureCompensation(0);
params.setJpegQuality(100);
// params.setPreviewSize(PreviewSizeWidth,PreviewSizeHeight);
//now that you have the list of supported sizes, pick one and set it back to the parameters...
//int w=0,h=0;
for(int i=0;i<sizes.size();i++)
{
if(sizes.get(i).width > size.width)
size = sizes.get(i);
}
params.setPictureSize(size.width, size.height);
Toast.makeText(getContext(), size.width+"and"+size.height,Toast.LENGTH_SHORT).show();
camera.setParameters(params);
if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)
{
params.set("orientation", "portrait");
camera.setDisplayOrientation(90);
}
camera.startPreview();
try
{
camera.setPreviewDisplay(holder);
}
catch (IOException exception)
{
camera.release();
camera = null;
}
}
}