Back to project page foxail_reader.
The source code is released under:
GNU General Public License
If you think the Android project foxail_reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.foxail.android.common; //www .jav a 2 s .c om import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; public class CommonUtil { public final static String MAIN_PACKAGE_NAME = "org.foxail.android.reader"; /** * ????????versionCode * * @param context * @return */ public static int getVerCode(Context context) { int verCode = -1; try { verCode = context.getPackageManager().getPackageInfo(MAIN_PACKAGE_NAME, 0).versionCode; } catch (NameNotFoundException e) { e.printStackTrace(); } return verCode; } /** * ????????versionName * * @param context * @return */ public static String getVerName(Context context) { String verName = ""; try { verName = context.getPackageManager().getPackageInfo(MAIN_PACKAGE_NAME, 0).versionName; } catch (NameNotFoundException e) { e.printStackTrace(); } return verName; } }