public class Utils {
//获取版本号
public static String createVersion(Context context) {
String versionCode = "";
PackageManager pm = context.getPackageManager();
try {
PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);
versionCode = packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return versionCode;
}
//获取版本号
public static int createVersionCode(Context context) {
int versionCode = 0;
PackageManager pm = context.getPackageManager();
try {
PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);
versionCode = packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return versionCode;
}
public static int[] getDisplay
好用的正则MD5工具类
最新推荐文章于 2023-04-18 18:23:15 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)