This is happening because when screen orientation rotates the Activity gets re-started. In this case you can add configChanges
attribute in your tag in the AndroidManifest file to stop the re-creation of the Activity.
<activity android:name=".Activity_name"
android:configChanges="orientation|keyboardHidden">
By, this your orientation can change will the progress bar is working and also it won’t stop though the orientation changes.
UPDATE
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){
setContentView(R.layout.login_landscape);
}
else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
setContentView(R.layout.login);
}
}