以invoke search android为例,每次onCreate()接收到查询搜索结果。怎样才能让它被onNewIntent()接收。哪种操作会导致onNewIntent()接收意图?
发布于 2010-03-31 21:01:59
要调用onNewIntent(),您的活动需要在清单中声明android:launchMode="singleTop"。如果接收到新的意图,并且活动堆栈上不存在该活动的实例,则将调用onCreate()。如果它确实存在于活动堆栈中,则将改为调用onNewIntent()。
android:launchMode的文档中有更多细节。
https://stackoverflow.com/questions/2551389
复制相似问题