See here: http://developer.android.com/training/basics/activity-lifecycle/recreating.html
According to the documentation, the activity is destroyed when the orientation changes. In order to save additional state information in such an event, you can override the onSaveInstanceState() method and add key-value pairs to the bundle object, like so:
public void onSaveInstanceState(Bundle savedInstanceState){
savedInstanceState.putInt("CurrentImageId", [current image id here]);
super.onSaveInstanceState(Bundle savedInstanceState);
}
Then, when the application is restored after the orientation change, you can retrieve the current image's id by overriding either the onCreate(Bundle savedInstanceState) method or the onRestoreInstanceState(Bundle savedInstanceState) method:
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
int currentImageId = savedInstanceState.getInt("CurrentImageId");
//Set the current image here, after retrieving the id
}
Of course, I don't know exactly how you're identifying your images, so I can't tell you exactly how to set/retrieve the current image's id.