第一种方法: private boolean isRtl() { return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; } 第二种方法: /** * Check to see if the current layout is Right-to-Left. This check is only * supported for API 17+. For earl…
public boolean isTabletDevice() { TelephonyManager telephony = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); int type = telephony.getPhoneType(); if (type == TelephonyManager.PHONE_TYPE_NONE) { …
实际应用开发时,如果存在需要用户获取大量数据的情况,最好是先判断下网络类型,提示用户当前的网络类型,是否需要连接Wifi,etc.(手机流量太贵啦,当然土豪是无视这玩意的, (/ □ \)). 定义网络连接类型: public static final int NETTYPE_NULL = 0x00; //未连接网络 public static final int NETTYPE_WIFI = 0x01; //WIFI public static final int NETTYPE_MOBILE…