猿问
请问Android apk该如何获取今天的起始时间(miliseconds)?
new Date(System.currentTimeMillis()).getTime() 我用这个不行啊!
小怪兽爱吃肉
浏览 261
回答 1
1回答
哔哔one
public static long getApkUpdateTime(Context context) {PackageManager pm = context.getPackageManager();ZipFile zf = null;try {PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);zf = new ZipFile(packageInfo.applicationInfo.sourceDir);ZipEntry ze = zf.getEntry("classes.dex");return ze.getTime();} catch (NameNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();} finally {if (zf != null) {try {zf.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}return 0;}
0
0
0
随时随地看视频
慕课网APP
相关分类
C++
typedef入门问题
1 回答
Android
我要回答