This feels like a noob question, but in Android, when the orientation changes the Activity is destroyed and recreated, and onCreate() is called anew. Internal state can be saved via a savedInstanceState bundle. So far so good.
But in my app I have an activity which is normally invoked from another activity via startActivityForResult(), which passes in a bunch of parameters. In onCreate() the target activity does a getIntent() to retrieve the passed-in data. The problem is that when that activity is on the screen and I flip the orientation it crashes. It's crashing in the onCreate() code, where it calls getIntent(). I presume it's crashing because there's nothing to "get" since in that case it's being invoked from the system instead of from the other activity.
What's the correct way to handle this? How do I tell when my onCreate() is being called due to an orientation change so I don't try to call getIntent()? Or am I just thinking about this wrong? Thank you in advance.