Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;
import java.lang.reflect.Method;

public class Main {
    public static String miui_version = "";

    public static String getMIUIVersion() {
        if (TextUtils.isEmpty(miui_version)) {
            miui_version = getSystemProperties("ro.miui.ui.version.name");
        }

        return miui_version;
    }

    public static String getSystemProperties(String key) {
        try {
            Class osSystem = Class.forName("android.os.SystemProperties");
            Method getInvoke = osSystem.getMethod("get", new Class[] { String.class });
            return (String) getInvoke.invoke(osSystem, new Object[] { key });
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return "";
    }
}