@@ -0,0 +1,1178 @@
+/**   %0A * @Title: PackageUtil.java%0A * @Package me.pc.mobile.helper.util%0A * @Description: TODO%0A * @author SilentKnight %7C%7C happychinapc@gmail.com%0A * @date 2014 2014-11-25 %E4%B8%8A%E5%8D%8810:41:46%0A * @version V1.0.0 %0A */%0Apackage me.pc.mobile.helper.v14.util;%0A%0Aimport android.content.Context;%0Aimport android.content.pm.PackageInfo;%0Aimport android.content.pm.PackageManager;%0Aimport android.content.pm.PackageManager.NameNotFoundException;%0A%0A/**%0A * @author SilentKnight%0A * %0A */%0Apublic final class PackageUtil %7B%0A%09private PackageUtil() %7B%0A%09%7D%0A%0A%09public static String getAppVersionName(Context context) %7B%0A%09%09try %7B%0A%09%09%09PackageManager manager = context.getPackageManager();%0A%09%09%09PackageInfo info = manager.getPackageInfo(context.getPackageName(),%0A%09%09%09%09%090);%0A%09%09%09return info.versionName;%0A%09%09%7D catch (NameNotFoundException e) %7B%0A%09%09%09// TODO Auto-generated catch block%0A%09%09%09return null;%0A%09%09%7D%0A%09%7D%0A%0A%09public static int getAppVersionCode(Context context) %7B%0A%09%09try %7B%0A%09%09%09PackageManager manager = context.getPackageManager();%0A%09%09%09PackageInfo info = manager.getPackageInfo(context.getPackageName(),%0A%09%09%09%09%090);%0A%09%09%09return info.versionCode;%0A%09%09%7D catch (NameNotFoundException e) %7B%0A%09%09%09// TODO Auto-generated catch block%0A%09%09%09return 0;%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create PackageUtil.java