android - APIdemo调用搜索问题android

标签 android

对于调用搜索 android 示例,每次查询搜索结果由 onCreate() 接收。 我怎样才能让它被 onNewIntent() 接收到。什么样的操作会导致onNewIntent()接收到intent?

最佳答案

您的 Activity 需要在 list 中声明 android:launchMode="singleTop" 以便调用 onNewIntent()。如果接收到新 Intent 并且 Activity 堆栈中不存在 Activity 实例,将调用 onCreate()。如果它确实存在于 Activity 堆栈中,则会调用 onNewIntent()

android:launchMode 的文档更详细一些。

关于android - APIdemo调用搜索问题android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2551389/

相关文章:

android - 布局看起来不同?

java - achartengine饼图未在 ScrollView 中呈现

java - 如何在 Map java 中允许重复值?

android - 从下到上和从右到左排列 ConstraintLayout 流引用

android - 从库中复制文件时显示 ProgressDialog

android - 在 Android Studio 的 "build"中检测到什么错误 - Gradle 的角色

android - 自定义 Facebook 登录按钮 - Android

java - oninfowindowclick 仅在有多个标记的情况下与标记信息一起使用

Android自定义控件这可能吗?

android - "The destination folder does not exist or is not writeable"Android Studio 3.4.2 尝试生成签名 apk 时出错