pixel pixel - 1 month ago 10
Android Question

How to clear Intent that started Activity?

At the beginning Activity is launched by an Intent and something is done with this Intent.

When I change orientation of my Activity, it's reloaded again and Intent is passed to the Activity.

How can I clear that Intent to prevent Activity from using it again?

I've tried

, but with no result.

dcg dcg

I had similar problem. This helped me. Maybe you have to also use onSaveInstanceState(Bundle outState) and add extra data to the bundle so inState is not null, not sure.

Intent activityIntent = null; // Subsequent times it's null

protected void onCreate(Bundle inState) {
    if (inState!=null) {
        /*Recreating activity with a saved state*/
    } else {
        /*Creating activity*/
        activityIntent = getIntent(); // First time through intent is used
        /*Get your Extra Intent data here. You will be capturing data on 1st creation. */