The following example gives the current screen orientation.
public int getScreenOrientation()
{
return getResources().getConfiguration().orientation;
}
The above method return integer. We will compare as follows.
if(getScreenOrientation() == Configuration.ORIENTATION_PORTRAIT)
{
//App is in Portrait mode
}
else
{
//App is in LandScape mode
}
public int getScreenOrientation()
{
return getResources().getConfiguration().orientation;
}
The above method return integer. We will compare as follows.
if(getScreenOrientation() == Configuration.ORIENTATION_PORTRAIT)
{
//App is in Portrait mode
}
else
{
//App is in LandScape mode
}
No comments:
Post a Comment