1

I have weird problem. How a Bundle can not be cleared after calling its method clear() This is my code :

if(isFromPushNotif) {
                        Bundle pushNotifBundle = getIntent().getExtras() ;
                        Log.i("SplashScreen"," before clear "+pushNotifBundle);
                        intent.putExtras(pushNotifBundle) ;
                        getIntent().getExtras().clear();
                        Log.i("SplashScreen"," after clear "+getIntent().getExtras()); //Here bundle is not cleared , log displays all the initial elements

                    }

startActivity(intent);
overridePendingTransition(0, 0);
finish();
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Imene Noomene
  • 3,035
  • 5
  • 18
  • 34

2 Answers2

0

Regarding the accepted answer here Android. Can't clear or replace extras

This problem was solved by using onNewIntent instead of using onCrete in Activity.

islamdidarmd
  • 725
  • 5
  • 19
0

Try this

  • clear your bundle

     getIntent().removeExtra("your_key_here_to_be_removed");
    
Community
  • 1
  • 1
Vishal Yadav
  • 1,020
  • 4
  • 15
  • 30