【问题标题】:How can I calculate the total number of times an activity in android is displayed on screen? [closed]如何计算 android 中的活动在屏幕上显示的总次数? [关闭]
【发布时间】:2017-07-05 21:00:56
【问题描述】:

假设我有一个SecondActivity,我打开应用程序并转到应该是count = 1 时间的 SecondActivity,现在我导航到 ThirdActivity 并返回到现在应该是 count=2SecondActivity。接下来我最小化应用程序,然后打开应用程序,计数现在应该是count = 3

【问题讨论】:

    标签: android android-studio android-activity


    【解决方案1】:

    在Activity中使用一个静态int,初始化为0。在onResume中,自增。

    【讨论】:

      猜你喜欢
      • 2012-05-11
      • 2014-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多