如何找出哪些Android设备将运行我的应用程序?
答
这里是代码:
public static boolean isHoneycomb() {
// Can use static final constants like HONEYCOMB, declared in later versions
// of the OS since they are inlined at compile time. This is guaranteed behavior.
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
public static boolean isHoneycombTablet(Context context) {
return isHoneycomb() && isTablet(context);
}
,或者你可以在AndroidManifest.xml设置suppurted屏幕:
<manifest ... >
<supports-screens android:xlargeScreens="true" />
...
</manifest>
访问的谷歌IO 2011官方源代码here如果你想更多细节。
我希望它有帮助!
答
还有android.os.Build类。在制造商和型号等方面有许多静态常量。