How to stop changing the orientation when a progress bar is spinning in android -
i have registration screen user enters registration details , when user clicks on "register" button showing progress bar(progress bar begins spin) , takes user home screen.if user rotates phone when progress bar spinning, progress bar gets dismissed.i want orientation not change potrait landscape , vice versa,when progress bar visible(meaning spinning).how stop orientation change when progress bar spinning?any appreciated.
this happening because when screen orientation rotates activity gets re-started. in case can add configchanges
attribute in tag in androidmanifest file stop re-creation of activity.
<activity android:name=".activity_name" android:configchanges="orientation|keyboardhidden">
by, orientation can change progress bar working , won't stop though 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); } }
Comments
Post a Comment