gpt4 book ai didi

java - 如何在android中获取屏幕/手机时间?

转载 作者:行者123 更新时间:2023-12-01 16:30:40 25 4
gpt4 key购买 nike

我正在尝试找出如何在android中获取屏幕时间,即花在手机上的时间。有没有这样的功能,或者我必须自己跟踪它。我尝试过寻找类似的问题,但没有成功。它是如何完成的?

最佳答案

1. Create a base activity and make your starting main activity on which the app is 
killed when the user destroys it and there extend from it.

long start = Calendar.getInstance().getTimeInMillis();
long end = Calendar.getInstance().getTimeInMillis();

2. In the ondestroy of this activity long total = end-start;
write this code.

关于java - 如何在android中获取屏幕/手机时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62047993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com