在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 這個講的就不錯

發佈了241 篇原創文章 · 獲贊 10 · 訪問量 23萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章