对于调用搜索 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/