android - Onstop method is called when Orientation changes -
when change orientation of android application, calls onstop method , oncreate. how avoid caling onstop , oncreate when orientation changes?
it have been long time since question have been active, sill need answer this. had same issue , found answer.
in manifest should add android:configchanges=orientation|screenlayout|layoutdirection
in activity should not call default actions on orientation change.
... <activity android:name=".activity" android:screenorientation="portrait" android:configchanges="orientation|screenlayout|layoutdirection|screensize" ...
, in activity:
@override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); // overrides default action }
original example:
http://android-er.blogspot.fi/2011/05/prevent-activity-restart-when-screen.html
Comments
Post a Comment