My case is that the logic is same for both Phone and Tablet. But there is slight difference in the layout. And I tried with the following code
public static boolean findoutDeviceType(Context context)
{
return (context.getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK)>=
Configuration.SCREENLAYOUT_SIZE_LARGE;
}
Samsung Tab 10" has the resolution of 1280 * 800 and S3 has the resolution of 1270 * 720. And this code returns the Size as XLarge for both the Tab and Phone as its criteria for checking is > 960 * 720.
I have tested inserting the respective UI in the layout folder in Res as Layout, Layout-Large and Layout-xLarge . But this didn't effect in anyway. while checking it took the UI from the Layout folder.
Anyway even though I place the UI in the different layout folders, I have to check them in the class file to set the respective ContentView.
Is there any other way to find it?