How to lock android screen orientation -


i'm making android video player.it has function user can watch video in orientation.i use code follow:

settings.system.putint(getcontentresolver(), settings.system.accelerometer_rotation, 1); 

it works, when add function user can lock orientation, did it:

settings.system.putint(getcontentresolver(), settings.system.accelerometer_rotation, 0); 

so met trouble. when i'm in landscape orientation , try lock orientation, screen turns portrait. can solve or tell me way it?

setrequestedorientation(activityinfo.screen_orientation_landscape); 

or

setrequestedorientation(activityinfo.screen_orientation_portrait);    

more info here: developing orientation-aware android applications


Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -