I’m trying to make an android app which has 2 layouts, one for phones and one for tablets.
I have the two layouts made, but I’m having difficulty populating them with content. The phone layout (res/layout) consists of 1 list view which is populated from a database.
The tablet layout (res/layout-large) has 5 separate listviews which all need to be populated.
Basically I need some way of doing this:
if(screensize != large) {
populateSingleListView();
}
else {
populateMultipleListViews();
}
I tried using the following code to do it but it doesn’t seem to detect the screen size within the emulator
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE)
any ideas for a solution?
Thanks
Chris
So in small screen, you have list1 populate and big screen you have both populated.