Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.util.Log;

public class Main {
    public static int getVerCode(Context context) {
        int verCode = -1;
        try {
            verCode = context.getPackageManager().getPackageInfo("com.chuangye", 0).versionCode;
        } catch (Exception e) {
            Log.e("getVerCode", e.getMessage());
        }
        return verCode;
    }
}