android - How to prevent screen autorotation but prevent activity from rotating -
this may sound newbie question anyway i'm new android development.
basically need prevent activity changing rotation meanwhile need detect device orientation change i.e. if device orientation has been changed top botton, or top left-portrait etc.
in ios there analogue - (bool)shouldautorotatetointerfaceorientation can handle device orientation change , tell view if want autorotate or not. please pay attention no manual data handling of accelerometer data.
so want detect device's orientation change , prevent activity rotating. i'm playing data sensor detect shake. internally android filtration of signals in order decide when rotate ui. need catch event. can ?
simple formulation of question : i need detect android device orientation change without playing manually sensor data, while keeping activity orientation stick orientation
this need if want fix 1 orientation landscape, go androidmanifest , in activity
<activity android:label="@string/app_name" android:name=".loginscreen" android:screenorientation="landscape" android:configchanges="keyboardhidden|orientation"> <intent-filter > <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> add this...if portrait change android:screenorientation="portrait"
and motion please refer @thepoosh link http://www.techrepublic.com/blog/app-builder/a-quick-tutorial-on-coding-androids-accelerometer/472
Comments
Post a Comment