views:

61

answers:

1

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 setIntent(null), but with no result.

A: 

My suggestion would be to toggle this with a boolean variable to check wheather your activity is first created or not.

Otherwise you can look at your onCreate method, afaik this is only executed, when the activity is first created.

poeschlorn
Agreed. Use `onRetainNonConfigurationInstance()` to pass the state from the old activity to the new one.
CommonsWare
Actually onCreate() would also be called any time your screen orientation changes (the app is basically destroyed and re-created during this).
source.rar