2
Which code perceives and returns the orientation of the screen?
If the cell phone is standing or lying down ?
2
Which code perceives and returns the orientation of the screen?
If the cell phone is standing or lying down ?
5
Configuration configuration = getResources().getConfiguration();
if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE){
//...
}else{
//...
}
In this example, it checks whether the screen position is Landscape (lying) if not, it can only be in Portrait (standing)!
Very simple.
2
To check orientation just use this code:
getResources().getConfiguration().orientation
There is a feedback for each type of guidance, which you can check below:
ORIENTATION_UNDEFINED
= 0ORIENTATION_PORTRAIT
= 1ORIENTATION_LANDSCAPE
= 2ORIENTATION_SQUARE
= 3Browser other questions tagged java android
You are not signed in. Login or sign up in order to post.