Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.NonNull;

public class Main {
    public static boolean doesDeviceSupportCameras(@NonNull Context context) {

        final PackageManager packageManager = context.getPackageManager();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
        } else {
            return packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)
                    || packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
        }
    }
}