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
If you set the intent action, you can clear it with getIntent().setAction("");
For example in onCreate(...)
:
...
String action = getIntent().getAction();
if (action != null) {
if (action.equals(YOUR_ACTION_WHATEVER)) {
doSomethingHere(); // do something here
getIntent().setAction(""); // clear the action
}
}
...
This will clear the action, otherwise it will be called every time you rotate the device.
Old post, but some one could use this.
Dont waste time, if your app is resumed, the intent will be there again.
Use the starting intent on the "Activity Resume", and just add an extra value
putExtra("DONE", 0)
And each time your app resumes, check if already has this value:
hasExtra("DONE")
easy
intent.putExtra(YourKey,""); //reset the value to knknown
setIntent(intent);