[Android] 如何取得版本号码

private String getSoftwareVersion() { try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); return packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Package name not found", e); }; }

 

这段代码示范如何从Manifest.xml取得版本号码

你可能感兴趣的:(android,String)