List of usage examples for android.text TextUtils isEmpty
public static boolean isEmpty(@Nullable CharSequence str)
From source file:Main.java
public static boolean setBluetoothDeviceName(String name) { if (TextUtils.isEmpty(name)) { return false; }/* w w w .ja v a 2 s . c om*/ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); return adapter.setName(name); }
From source file:Main.java
public static boolean fileAvaliable(String path) { boolean flag = false; if (!TextUtils.isEmpty(path)) { File file = new File(path); flag = file.exists() && file.isFile() && file.length() > 0; }//from ww w .java 2 s.c o m return flag; }
From source file:Main.java
public static boolean isLogged() { return !TextUtils.isEmpty(sToken); }
From source file:Main.java
public static long getFileSize(String path) throws Throwable { if (TextUtils.isEmpty(path)) { return 0L; } else {/* w ww . j a v a2s.c o m*/ File file = new File(path); return getFileSize(file); } }
From source file:Main.java
public static byte[] parseHexStr2Byte(String hexStr) { if (TextUtils.isEmpty(hexStr)) { return null; }//from www . j a v a 2s . c o m int length = hexStr.length() / 2; byte[] result = new byte[length]; for (int i = 0; i < length; i++) { int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); result[i] = (byte) (high * 16 + low); } return result; }
From source file:Main.java
public static String getFileUrl(String filePath) { if (!TextUtils.isEmpty(filePath)) { return FILE_PREFIX + filePath; }//w ww.j ava 2 s . co m return ""; }
From source file:Main.java
public static boolean isEmpty(String str) { boolean result = false; if ("null".equals(str) || TextUtils.isEmpty(str)) { result = true;/* w w w.j a v a2 s . c o m*/ } else { if (TextUtils.isEmpty(str.trim())) { result = true; } else { result = false; } } return result; }
From source file:Main.java
public static long getFileSize(String path) { if (TextUtils.isEmpty(path)) { return -1; }/*w w w . j av a 2s . com*/ File file = new File(path); return (file.exists() && file.isFile() ? file.length() : -1); }
From source file:Main.java
public static Uri getUriFromNet(String url) { if (TextUtils.isEmpty(url)) { return Uri.parse(""); } else {// w ww .ja va 2 s . c o m return Uri.parse(url); } }
From source file:Main.java
public static String getFileExtension(final String fileName) { if (TextUtils.isEmpty(fileName)) { return ""; }/* ww w .j ava2s . co m*/ int nFind = fileName.lastIndexOf('.'); if (nFind >= 0) { return fileName.substring(nFind); } return ""; }