Ok, so the above answer works to an extent, but you should not be doing what you are doing on onStop
. The problem you are getting seems to be coming from the fact that you need to save the extras you get from the calling Activity. I am going to assume what you are sending it will never really change, and you can expect it to always send the same amount of extras, but dynamic data in them.
@Override
onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
Intent intent = getIntent();
savedInstanceState.putStringArrayList("photos", intent.getStringArrayListExtra("some_string"));
}
Then in onCreate you can do something like this:
onCreate(Bundle savedInstanceState) {
/*I assume you got stuff places so just fit it in somewhere nice*/
Intent resultIntent = new Intent();
if(savedInstanceState == null) {
//we know here that this is the first call to the second Activity
//So you can just put the Intent that was sent since we know it came from the calling Activity with the original stuff
resultIntent = getIntent();
} else {
resultIntent.putStringArrayListExtra("photos", bundle.getStringArrayListExtra());
}
}
So hopefully you understand what I did there. It essentially gives you a way to have access to anything you need to persist beyond reload. Now you can do setResult(RESULT_OK, resultIntent);
wherever it is you would have normally had it if the orientation issue had never existed. So as you see thats less code that having to override things you may only need for that. Let me know if it makes sense. Oh and DO NOT add anything to disable orientation if you do it like this :)