Android应用获取最新日期 [英] Android app get last date updated

查看:67
本文介绍了Android应用获取最新日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取应用程序的最近更新日期?我想像这样在应用程序中显示它:

Is it possible to get the date when the app was last updated? I want to show it in the app like this:

  String htmltext = "E-mail: " + Datacontainer.Instance().GetDatabaseHelper().GetUserEmail() +
                    "<br>Authorized: " + is_auth +
                    "<br>Last updated on: " + "?" +
                    "<br>Tips version: " + "228" +
                    "<br>App version: " + "v 1.3.0" +
                    "<br>Your Airline: " + "?" +
                    "<br>Your Nickname: " + "?" +
                    "<br>No of tips submitted: " + "?";

  TextView infotext = (TextView)fragmentView.findViewById(R.id.infotext);
  infotext.setText(Html.fromHtml(htmltext));

推荐答案

尝试一下:

PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo("app.package.name", 0);
String appFile = appInfo.sourceDir;
long installed = new File(appFile).lastModified(); //Epoch Time

这篇关于Android应用获取最新日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆