Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;

public class Main {
    /**
     * Get the major openGL version that is actually available on this device (ie 3).
     *
     * @param context
     * @return
     */
    public static int getDeviceGLMajorVersion(Context context) {
        int deviceGLVersion = getDeviceGLVersion(context);
        return deviceGLVersion >> 4;
    }

    /**
     * Gets the openGL version that is actually available on this device (ie GL_VERSION_31).
     *
     * @param context
     * @return
     */
    public static int getDeviceGLVersion(Context context) {
        final ActivityManager activityManager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        return configurationInfo.reqGlEsVersion;
    }
}