How to detect device is Android phone or Android tablet?

Use this:

public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

which will return true if the device is operating on a large screen.

Some other helpful methods can be found here.

Leave a Comment