public final class Utils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int |
copy(java.io.InputStream input,
java.io.OutputStream output)
Copies data from one input stream to the other using a buffer of 8 kilobyte in size.
|
static void |
copyFile(java.io.File src,
java.io.File dst)
Copies the contents of one file to the other using
FileChannels. |
static int |
dpToPx(int dp) |
static <T> void |
executeAsyncTask(android.os.AsyncTask<T,?,?> task,
T... args)
Execute an
AsyncTask on a thread pool. |
static int |
getScreenHeight(android.content.Context c) |
static int |
getScreenWidth(android.content.Context c) |
static boolean |
isExtStorageAvailable()
Checks if
Environment.MEDIA_MOUNTED is returned by getExternalStorageState()
and therefore external storage is read- and writeable. |
static boolean |
isGingerbreadOrHigher() |
static boolean |
isGoogleTV(android.content.Context context) |
static boolean |
isHoneycombOrHigher() |
static boolean |
isICSOrHigher() |
static boolean |
isJellyBeanMR1OrHigher() |
static boolean |
isJellyBeanOrHigher() |
static boolean |
isKitKatOrHigher() |
static boolean |
isLollipopOrHigher() |
static boolean |
isNetworkConnected(android.content.Context context)
Whether there is any network connected.
|
static boolean |
isRtlLayout() |
static boolean |
isTablet(android.content.res.Resources res) |
static boolean |
isWifiConnected(android.content.Context context)
Whether there is an active WiFi connection.
|
public static boolean isKitKatOrHigher()
public static boolean isJellyBeanMR1OrHigher()
public static boolean isJellyBeanOrHigher()
public static boolean isICSOrHigher()
public static boolean isHoneycombOrHigher()
public static boolean isGingerbreadOrHigher()
public static boolean isGoogleTV(android.content.Context context)
public static boolean isLollipopOrHigher()
public static boolean isExtStorageAvailable()
Environment.MEDIA_MOUNTED is returned by getExternalStorageState()
and therefore external storage is read- and writeable.public static boolean isNetworkConnected(android.content.Context context)
public static boolean isRtlLayout()
public static boolean isWifiConnected(android.content.Context context)
public static void copyFile(java.io.File src,
java.io.File dst)
throws java.io.IOException
FileChannels.src - source Filedst - destination Filejava.io.IOExceptionpublic static int copy(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
input - InputStreamoutput - OutputStreamjava.io.IOExceptionpublic static <T> void executeAsyncTask(android.os.AsyncTask<T,?,?> task,
T... args)
AsyncTask on a thread pool.T - Task argument type.task - Task to execute.args - Optional arguments to pass to AsyncTask.execute(Object[]).public static boolean isTablet(android.content.res.Resources res)
public static int dpToPx(int dp)
public static int getScreenHeight(android.content.Context c)
public static int getScreenWidth(android.content.Context c)