gpt4 book ai didi

android:如何用长按后退按钮 Action 声明一个IntentFilter?

转载 作者:行者123 更新时间:2023-11-29 00:24:10 26 4
gpt4 key购买 nike

有谁知道如何声明一个带有长按后退按钮 Action 的 IntentFilter 吗?我知道长按搜索按钮有一个 ACTION_SEARCH_LONG_PRESS 选项,但没有对应的选项作为后退按钮的 ACTION_BACK_LONG_PRESS 。这意味着您可以:

IntentFilter filter = new IntentFilter(Intent.ACTION_SEARCH_LONG_PRESS);

但你不能这样做:

IntentFilter filter = new IntentFilter(Intent.ACTION_BACK_LONG_PRESS);

那么我怎样才能添加一个选项 ACTION_BACK_LONG_PRESS 来使第二个命令有效呢?或者是否有替代方法来实现这一点?

最佳答案

So how can I add an option ACTION_BACK_LONG_PRESS to make the second command valid?

你不能。 Android SDK 不提供从应用外部检测此事件的方法。

Or is there a alternative way to implement this?

如果您的目标是在前台检测长按 BACK 的 Activity ,you can handle that through onKeyLongPress() .

关于android:如何用长按后退按钮 Action 声明一个IntentFilter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21006347/

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