This article describes the Android programming approach to getting package names, version information, and versionname names. Share to everyone for your reference, specific as follows:
Words do not say, directly on the code, here, mainly in the version of the upgrade, the use of more.
Private String Getappinfo () {
try {
string pkname = This.getpackagename ();
String versionname = This.getpackagemanager (). Getpackageinfo (
pkname, 0). versionname;
int versioncode = This.getpackagemanager ()
. Getpackageinfo (pkname, 0). Versioncode;
return pkname + " " + Versionname + "" + Versioncode;
} catch (Exception e) {
} return
null;
}
For more information on Android-related content readers can view the site: "Android graphics and image processing skills summary", "Android Development introduction and Advanced Course", "Android debugging techniques and common problems solution summary", " Android Multimedia How-to Summary (audio, video, audio, etc), summary of Android Basic components usage, Android View tips Summary, Android layout layout tips and a summary of Android controls usage
I hope this article will help you with the Android program.