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

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -