Android examples for android.hardware:Camera State
throw Exception If Camera is Disabled
import android.app.Activity; import android.app.admin.DevicePolicyManager; import android.content.Context; public class Main { static void throwIfCameraDisabled(Activity activity) throws Exception { // Check if device policy has disabled the camera. DevicePolicyManager dpm = (DevicePolicyManager) activity.getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm.getCameraDisabled(null)) { throw new Exception(); }/*from www .j ava 2s. c o m*/ } }