List of usage examples for android.content.pm PackageManager FEATURE_CAMERA_FLASH
String FEATURE_CAMERA_FLASH
To view the source code for android.content.pm PackageManager FEATURE_CAMERA_FLASH.
Click Source Link
From source file:Main.java
public static boolean isFlashSupported(PackageManager packageManager) { // if device support camera flash? if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) { return true; }/*ww w .java 2 s .c o m*/ return false; }
From source file:Main.java
private static boolean isFlashSupported(Context context) { PackageManager pm = context.getPackageManager(); return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); }
From source file:Main.java
public static boolean isFlashAvailable(Context context) { return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); }
From source file:Main.java
public static boolean hasFlash(Context con) { if (mHasFlash != null) return mHasFlash; try {/* w w w .jav a 2 s . com*/ PackageManager pm = con.getPackageManager(); mHasFlash = pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); return mHasFlash; } catch (Throwable t) { mHasFlash = null; return false; } }
From source file:Main.java
public static boolean flashLightAvailable(Context context) { boolean available = false; do {//from w ww . j av a 2 s .co m if (null == context) { break; } available = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); } while (false); return available; }
From source file:Main.java
public static boolean isFlashSupported(Context context) { PackageManager packageManager = context.getPackageManager(); // if device support camera flash? if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) { return true; }/*from w w w . ja v a2 s .com*/ return false; }
From source file:Main.java
public static void turnOnFlash(Context context, Camera camera, int currentCameraId) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) { Parameters params = camera.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_TORCH); camera.setParameters(params);/*from w w w . jav a2s .c om*/ } }
From source file:Main.java
public static void turnOffFlash(Context context, Camera camera, int currentCameraId) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) { Parameters params = camera.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_OFF); camera.setParameters(params);/*from w w w. j ava 2 s . c o m*/ } }
From source file:Main.java
public static boolean isCameraFlashEnable(Context context) { PackageManager pm = (PackageManager) context.getPackageManager(); FeatureInfo[] features = pm.getSystemAvailableFeatures(); for (FeatureInfo f : features) { if (PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) { return true; }//from ww w. j av a2 s . c o m } return false; }
From source file:Main.java
/** * Checks if the device has a camera flash * * @param context the context// w w w . ja va 2 s .c o m * @return true if camera flash is available */ public static boolean hasCameraFlash(@NonNull Context context, @NonNull Camera camera) { boolean hasFlash = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); try { Camera.Parameters p; if (hasFlash) { p = camera.getParameters(); if (p.getSupportedFlashModes() == null) { hasFlash = false; } else { if (p.getSupportedFlashModes().size() == 1 && p.getSupportedFlashModes().get(0).equals("off")) { hasFlash = false; } } } } finally { camera.release(); } return hasFlash; }