gpt4 book ai didi

android - 如何在运行时处理 android Intent ?

转载 作者:行者123 更新时间:2023-11-30 02:04:42 24 4
gpt4 key购买 nike

我了解 intents 用于启动新的 activitiesservices 并且可以包含有关这些的信息 - 某些 UI 选项等。它们可以由一些 activity 或应用程序发出,以表示其他 Activity 应该开始或结束,或者应该发生一些变化。

我不明白系统在运行时如何处理这些。是将它们发送到操作系统,在那里将它们中继到需要它们的地方,还是让所有 Activity 实例不断检查发出的每个 intent,看看是否他们申请?

此外,关于这一点,所有 Activity 实例都可以“监听”所有 Intent 吗?如果不能,这种“监听权限”是如何赋予的?

最佳答案

Do these go to the OS, where they are relayed to the place where they are needed

是的。毕竟,大多数时候,要启动的 Activity 目前并不存在。

Also, on that note, can all Activity instances "listen" to all intents

Activity 不“监听”任何Intents . Activity 通过 list 描述什么 Intent他们感兴趣的结构,通过 <intent-filter>元素。然后操作系统确定处理任何特定的 Activity startActivity()调用(可能在用户的帮助下,通过选择器 UI)并启动该 Activity 。

关于android - 如何在运行时处理 android Intent ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30873025/

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