【发布时间】:2021-03-05 14:20:14
【问题描述】:
我在片段中有一个有效的搜索视图,并决定为其添加语音。我按照指南创建了一个单独的活动来保存结果。这一切都适用于代码
private fun handleIntent(intent: Intent) {
if (Intent.ACTION_SEARCH == intent.action) {
intent.getStringExtra(SearchManager.QUERY)?.also { query ->
// blahh blahh `blahhh`
}
}
}
我现在想将结果发送到上面有搜索视图的片段。从意图过滤器开始的操作(android.intent.action.SEARCH)执行此操作的标准方法是什么。
我确实尝试将意图过滤器放在包含片段的活动上,但它似乎启动了一个新实例,因此我无法使用 findfragmentByTag。
谢谢
【问题讨论】:
标签: android android-activity searchview searchmanager