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


之前 想做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
    }
希望搜到这个帖子的后来者能获得这种解决方法

然后就知道onNewIntent这东西,,http://www.cnblogs.com/zenfly/archive/2012/02/10/2345196.html 这个讲的就不错

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/france/p/4808542.html