Android examples for android.hardware:Close Camera
close Camera
import android.content.Context; import android.content.pm.PackageManager; import android.hardware.Camera; public class Main{ public static void close(Context context) { Camera cam = Camera.open();//from w ww.j a v a 2s.c o m cam.stopPreview(); cam.release(); } public static void open(Context context) { Camera cam = Camera.open(); Camera.Parameters p = cam.getParameters(); p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); cam.setParameters(p); cam.startPreview(); } }