问题描述:我在做单击消息状态栏要进入到指定页面,intent一直得不到值;
我的流程如下 A图–B图–C图
问题点: 清单配置文件启动模式: android:launchMode=“singleTask”
栈顶复用模式,如果要开启的activity在任务栈的顶部已经存在,就不会创建新的实例,而是调用 onNewIntent() 方法。避免栈顶的activity被重复的创建。
解决方案 直接重写onNewIntent方法就行
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
//重写intent
setIntent(intent);
}
结果如下
最后得到想要的参数了!