- private String getVersion(){
- try {
- //通过PackageManager获取安装包信息
- PackageInfo packageInfo =
- getPackageManager().getPackageInfo(getPackageName(),0);
- //返回版本信息
- return packageInfo.versionName;
- } catch (NameNotFoundException e) {
- return "";
- }
- }
复制代码
看不太懂 能不能解释啊 |
|