I'm developing an app targeting android 4+, that behaves differently depending on screen size. More in detail:
- On small/medium screens, orientation is forced on portrait, and app runs by switching activities.
- On large/x-large screens, orientation is forced on landscpe, screen is split into two, with the menu fragment on the left, and other fragments on the right.
Problem is, I can't create an AVD that gets detected as a large screen.
Just tested on an AVD with 640x1024 resolution, 240 density, this code never goes into the first IF.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// forcing layout to landscape if display is LARGE or more
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE ||
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
dualPane = true;
}
else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
dualPane = false;
}
}
Any help?