android - Locking orientation to portrait force close in my phone -


i want app lock portrait mode. used code :

<activity android:name="myactivity"                   android:label="@string/app_name" android:screenorientation="portrait"                   android:configchanges="orientation|keyboardhidden"                   > 

and in myactivity class :

public void onconfigurationchanged(configuration newconfig)     {         super.onconfigurationchanged(newconfig);         setrequestedorientation(activityinfo.screen_orientation_portrait);     } 

this code work correctly in emulator, when install , run in phone, app force closed. how can solve problem?

yo use in manifest there no need use pragmatically. remove onconfigurationchanged method code.


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -