pixel pixel - 1 year ago 127
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
Answer Source

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. */
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download