您的位置:首页 > 其它

在onResume()中调用getIntent()得不到Extra的问题

2015-08-09 17:21 357 查看
之前 想做activity间的传值,注意 不是 startActivityforResult的那种, 在启动了多层activity再次启动activity想进入到singleTask的MainActivity

原来只知道启动的顺序为

I/@@@philn(12410): onRestart

I/@@@philn(12410): onStart

I/@@@philn(12410): onResume

然后在onRestart里面 getIntent还是得不到数据,

有人也问了这问题
http://bbs.csdn.net/topics/370120610
某网友给出了解答方向

回复于: 2012-06-20 16:01:31

这么老的帖子都被搜到了,不知道LZ解决了没,我遇到和这一样的问题,解决方法是添加这个函数就ok了,

protected void onNewIntent(Intent intent) {

super.onNewIntent(intent);

setIntent(intent);// must store the new intent unless getIntent() will

// return the old one

}

希望搜到这个帖子的后来者能获得这种解决方法

对我有用[6] 丢个板砖[0] 引用 | 举报 | 管理

然后就知道onNewIntent这东西,,http://www.cnblogs.com/zenfly/archive/2012/02/10/2345196.html 这个讲的就不错
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: