-
public class AppUtils
-
-
Method Summary
Modifier and Type Method Description static ObjectloadDefaultsFromMetadata(Context context, String keyString)static StringgetStringMeta(Context context, String key)static intgetIntMeta(Context context, String key)static StringgetAppName(Context context)static intgetNetworkState(Context context)static booleanisNetworkAvailable(Context context)static longgetAvailableMemory()获取实际可用内存,单位 MB。 static longgetAppAvailableMemory()获取应用剩余内存,单位 MB。 static longgetDeviceAvailableMemory()获取设备剩余内存,单位 MB。 static booleanisMainProcess(Context context)static StringgetProcessName()static StringgetCurrentProcessNameByApplication()通过Application新的API获取进程名,无需反射,无需IPC,效率最高。 static StringgetCurrentProcessNameByActivityThread()通过反射ActivityThread获取进程名,避免了ipc static floatfloatAndDouble(float f1, double f2)static intgetVersionCode(Context context)获取应用的VersionCode static intgetVersionName(Context context)获取应用的VersionName static booleanisNumeric(String str)static StringgetSystemVersion()获取系统版本,例如:11 static StringgetDeviceModel()获取设备型号,例如:SM-A705FN static StringgetBrandName()获取品牌名称,例如:samsung static intgetAvailableProcessors()获取内核数(CPU核心数),例如:8 static List<out Object>getFirstFiveElements(List<out Object> list)-
-
Method Detail
-
loadDefaultsFromMetadata
static Object loadDefaultsFromMetadata(Context context, String keyString)
-
getStringMeta
@Nullable() static String getStringMeta(Context context, String key)
-
getIntMeta
@Nullable() static int getIntMeta(Context context, String key)
-
getAppName
static String getAppName(Context context)
-
getNetworkState
static int getNetworkState(Context context)
-
isNetworkAvailable
static boolean isNetworkAvailable(Context context)
-
getAvailableMemory
static long getAvailableMemory()
获取实际可用内存,单位 MB。
-
getAppAvailableMemory
static long getAppAvailableMemory()
获取应用剩余内存,单位 MB。
-
getDeviceAvailableMemory
static long getDeviceAvailableMemory()
获取设备剩余内存,单位 MB。
-
isMainProcess
static boolean isMainProcess(Context context)
-
getProcessName
static String getProcessName()
-
getCurrentProcessNameByApplication
static String getCurrentProcessNameByApplication()
通过Application新的API获取进程名,无需反射,无需IPC,效率最高。
-
getCurrentProcessNameByActivityThread
static String getCurrentProcessNameByActivityThread()
通过反射ActivityThread获取进程名,避免了ipc
-
floatAndDouble
static float floatAndDouble(float f1, double f2)
-
getVersionCode
static int getVersionCode(Context context)
获取应用的VersionCode
-
getVersionName
static int getVersionName(Context context)
获取应用的VersionName
-
getSystemVersion
static String getSystemVersion()
获取系统版本,例如:11
-
getDeviceModel
static String getDeviceModel()
获取设备型号,例如:SM-A705FN
-
getBrandName
static String getBrandName()
获取品牌名称,例如:samsung
-
getAvailableProcessors
static int getAvailableProcessors()
获取内核数(CPU核心数),例如:8
-
getFirstFiveElements
static List<out Object> getFirstFiveElements(List<out Object> list)
-
-
-
-