Back to project page pdsql.
The source code is released under:
Apache License
If you think the Android project pdsql 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 com.piscessera.pdsql.utils; //from ww w .j a v a 2s . c o m import android.content.Context; public class ApplicationUtil { public static int getAppVersionCode(Context ctx) { int result = -1; try { String pkg = ctx.getPackageName(); result = ctx.getPackageManager().getPackageInfo(pkg, 0).versionCode; } catch (Exception e) { e.printStackTrace(); } return result; } public static String getAppVersionName(Context ctx) { String result = "?"; try { String pkg = ctx.getPackageName(); result = ctx.getPackageManager().getPackageInfo(pkg, 0).versionName; } catch (Exception e) { e.printStackTrace(); } return result; } }