Whenever the orientation changes, the application starts over in the onResume() method.
If you do not want it to change orientation when the user flips the phone, you need to set this in your manifest file:
<activity android:name="YourActivity"
android:screenOrientation="portrait" />
Or landscape if you wish.
If you do want your application to continue where it left of before the user changed orientation on the phone and you do want your application to change orientation too, you need to keep track of the state of the application and set these values in your onResume()-method.