Clearing intent

UPDATE:

I didn’t realise this answer would be referred to so much when I first wrote it more then 5 years ago!

I’ll clarify to point out that as per @tato-rodrigo answer this won’t help you detect an already handled intent in some situations.

Also I should point out I put “clear” in quotes for a reason – you are not really clearing the intent by doing this, you’re just using the removal of the extra as a flag that this intent has been seen by the activity already.


I had exactly the same issue.

Above answer put me on the right track and I found even simpler solution, use the:

getIntent().removeExtra("key"); 

method call to “clear” the Intent.

Its a bit late answering since this was asked a year ago, but hopefully this helps others in the future.

Leave a Comment