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

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -