Check if has Front Camera - Android android.hardware

Android examples for android.hardware:Front Camera

Description

Check if has Front Camera

Demo Code

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;

public class Main{

    /**/*  www .j  a  v a 2s . co  m*/
     * @param context
     *         the application context
     * @return true if the device has a front camera, false else
     */
    public static boolean hasCameraFront(Context context) {
        PackageManager pm = context.getPackageManager();
        return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
    }

}

Related Tutorials