I like Ol_v_er's solution and it's simplicity however, I've found that it's not always that simple, what with new devices and displays constantly coming out, and I want to be a little more "granular" in trying to figure out the actual screen size. One other solution that I found here by John uses a String resource, instead of a boolean, to specify the tablet size. So, instead of just putting true in a /res/values-sw600dp/screen.xml file (assuming this is where your layouts are for small tablets) you would put:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="screen_type">7-inch-tablet</string>
</resources>
Reference it as follows and then do what you need based on the result:
String screenType = getResources().getString(R.string.screen_type);
if (screenType.equals("7-inch-tablet")) {
// do something
} else {
// do something else
}
Sean O'Toole's answer for Detect 7 inch and 10 inch tablet programmatically was also what I was looking for. You might want to check that out if the answers here don't allow you to be as specific as you'd like. He does a great job of explaining how to calculate different metrics to figure out what you're actually dealing with.
UPDATE
In looking at the Google I/O 2013 app source code, I ran across the following that they use to identify if the device is a tablet or not, so I figured I'd add it. The above gives you a little more "control" over it, but if you just want to know if it's a tablet, the following is pretty simple:
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}