private boolean isTabletDevice() {
if (android.os.Build.VERSION.SDK_INT >= 11) { // honeycomb
// test screen size, use reflection because isLayoutSizeAtLeast is only available since 11
Configuration con = getResources().getConfiguration();
try {
Method mIsLayoutSizeAtLeast = con.getClass().getMethod("isLayoutSizeAtLeast");
Boolean r = (Boolean) mIsLayoutSizeAtLeast.invoke(con, 0x00000004); // Configuration.SCREENLAYOUT_SIZE_XLARGE
return r;
} catch (Exception x) {
return false;
}
}
return false;
}
3 Comments
ups there's a bug. Unfortunately I can't edit the post. Here's the correct code snipped:
Actually, if you're testing for the SDK version, you don't have to use reflection at all! That's just making the code less readable, and making the app use reflection for no reason.
If you're inside that if block, then you can just run the method directly!
AVCHD Video Converter enables Windows user to convert and import AVCHD, AVCHD lite, MTS, M2TS,TRP, TP, TS files to Windows Movie Maker WMV, AVI, MPG, iPad 2, iPod, iPhone 4S, Kindle Fire, Samsung Galaxy Tab 10.1 etc.