I need to figure out how to get or make a build number for my Android application. I need the build number to display in the UI.
Do I have to do something with
PackageInfo pinfo = null; try { pinfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } int versionNumber = pinfo.versionCode; String versionName = pinfo.versionName;