话不多说 直接上代码,
@SuppressLint("NewApi")
public static boolean isSupportFrontCamera() {
if (!hasGingerbread()) {
return false;
}
@SuppressWarnings("deprecation")
int numberOfCameras = android.hardware.Camera.getNumberOfCameras();
if (2 == numberOfCameras) {
return true;
}
return false;
}
public static boolean hasGingerbread() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
}
搞定