我想知道用户何时与我的应用进行交互。我已尝试使用 Window.Callback
,但我遇到了 Toolbar 的问题。
如果我们调用 setSupportActionBar
(setActionBar
),我的 Window.Callback
将不再接收事件。
限制:
我无法扩展 Activity
。我需要一个全局位置来处理与应用程序的所有交互。
最佳答案
尝试 onUserInteraction() .
Called whenever a key, touch, or trackball event is dispatched to the activity. Implement this method if you wish to know that the user has interacted with the device in some way while your activity is running.
关于android - 如何检查用户是否触摸了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55470754/