Android-未调用onNewIntent-singletop活动 [英] Android - onNewIntent is not called - singletop activities

查看:250
本文介绍了Android-未调用onNewIntent-singletop活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有启动器A(活动A1)和应用程序B(活动B1,B2均为单顶).

I have launcher A (activity A1) and application B (activities B1, B2 both singletop).

A1-> B1-> B2-> A1-> B2.

A1 -> B1 -> B2 -> A1 -> B2.

但是,未在活动B2上调用onNewIntent,但B2却直接调用了onResume,但没有调用onNewIntent.

However onNewIntent wasn't called on activity B2, B2 did call direct onResume but not onNewIntent.

发起人A:活动A1:

Intent app_B = getPackageManager().getLaunchIntentForPackage(PACKAGE_B);
startActivity(app_B);

我想要:

A1 -> B1 -> B2 -> A1 -> B2.onNewIntent(Intent intent)

但不是:

A1 -> B1 -> B2 -> A1 -> B2.onResume() 

有人可以帮我吗?谢谢. (在Android 4.4.2上调试)

Can someone helps me out? Thanks. (Debug on Android 4.4.2)

推荐答案

onNewIntent(Intent intent)

在创建活动之前仅被调用一次.之后,直到您销毁并重新创建活动后,它才会调用... 请参阅文档,它将使您更加清楚, http://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)

is only called once before the activity is created. After that It will not call untill you destroy and recreate the activity... Please see the docs, It will more clarify you, http://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)

这篇关于Android-未调用onNewIntent-singletop活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆