gpt4 book ai didi

android - 如何检测 Android 中的用户交互

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:42:55 24 4
gpt4 key购买 nike

我的应用程序中有一个计时器,我想在用户交互时重置它。

我尝试添加 onTouchListener,但它阻止了我的 onClickListener。

最佳答案

查看此链接 How to detect USER INACTIVITY in android

在 android Activity 中有一个可用的方法叫做 onUserInteraction 在 onUserInteraction 方法的帮助下我们可以找到与特定 Activity 的用户交互

@Override
public void onUserInteraction()
{
MyTimerClass.getInstance().resetTimer();
}

关于android - 如何检测 Android 中的用户交互,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32068562/

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