Currently using the below code but getting the same as normal for all Categories. Even if I go to setting and set as small also. Please help me.
if ((getResources().getConfiguration().screenLayout &Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
Toast.makeText(HomePage.this, "Normal Size", Toast.LENGTH_LONG).show();
}else if((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)==Configuration.SCREENLAYOUT_SIZE_SMALL) {
Toast.makeText(HomePage.this, "Small Size", Toast.LENGTH_LONG).show();
}
I am not sure why it's not working. Please check the below code in your device.
To check small screen, atleast 320x426 dp and above
getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL);To check normal screen, atleast 320x470 dp and above
getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);To check large screen, atleast 480x640 dp and above
getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE);To check extra large screen, atleast 720x960 dp and above
getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE);