How to determine the target device programmatically in Android?
问题 I would like to programmatically determine (on the Android platform), if the target device is a phone or a tablet. Is there a way to do this? I tried using Density Metrics to determine the resolution and used resources (images and layouts) accordingly but, it did not turn out well. There are differences when I launch the app on a phone (Droid X) and a tablet (Samsung Galaxy 10.1). Please advise. 回答1: You can use this code private boolean isTabletDevice() { if (android.os.Build.VERSION.SDK_INT