close Camera - Android android.hardware

Android examples for android.hardware:Close Camera

Description

close Camera

Demo Code

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

    }

}

Related Tutorials