Since tablet are in general bigger than smartphones and since a low res tablet may have the same number of pixels as a high res smartphone, one way to solve this is to calculate the physical SIZE (not resolution) of a device:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
float yInches= metrics.heightPixels/metrics.ydpi;
float xInches= metrics.widthPixels/metrics.xdpi;
if (yInches> smallestTabletSize|| xInches > smallestTabletSize)
{
//We are on a
}