You can identify Mobile and Tablet Devices with simple flag condition.
Set a boolean value in a specific value file like say (
Then, in the "standard" value file like say (
Then from your
Thanks.
Set a boolean value in a specific value file like say (
res/values-xlarge/
):<resources>
<bool name="isTabletDevice">true</bool>
</resources>
Then, in the "standard" value file like say (
res/values/
):<resources>
<bool name="isTabletDevice">false</bool>
</resources>
Then from your
activity
, fetch this flag value
to check device type
:boolean tabletDeviceSize = getResources().getBoolean(R.bool.isTabletDevice);
if (tabletDeviceSize) {
//use tablet code
} else {
//use mobile code
}
Thanks.
No comments:
Post a Comment