@Test public void getFolder() { String res = Utils.getFolder("/storage/sdcard0/images/"); assertEquals("/storage/sdcard0/images", res); res = Utils.getFolder("/storage/sdcard0/images/aa.pic"); assertEquals("/storage/sdcard0/images", res); }
public static String getFolder(String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash > 0) { return path.substring(0, lastSlash); } return null; }
Utils { public static String getFolder(String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash > 0) { return path.substring(0, lastSlash); } return null; } }
Utils { public static String getFolder(String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash > 0) { return path.substring(0, lastSlash); } return null; }  }
Utils { public static String getFolder(String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash > 0) { return path.substring(0, lastSlash); } return null; }  static boolean isNetworkAvailable(Context context); boolean isExternalStorageWritable(); boolean isExternalStorageReadable(); static String readFile(String pathname); static String getFolder(String path); static String getFileNameWithoutExtension(String path); static Set<Integer> loadHiddenFoldersFromDisk(Context context); static void writeHiddenFolders(Context context); static void addHiddenFolder(Context context, int folderHash); static void removeHiddenFolder(Context context, int folderHash); }
Utils { public static String getFolder(String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash > 0) { return path.substring(0, lastSlash); } return null; }  static boolean isNetworkAvailable(Context context); boolean isExternalStorageWritable(); boolean isExternalStorageReadable(); static String readFile(String pathname); static String getFolder(String path); static String getFileNameWithoutExtension(String path); static Set<Integer> loadHiddenFoldersFromDisk(Context context); static void writeHiddenFolders(Context context); static void addHiddenFolder(Context context, int folderHash); static void removeHiddenFolder(Context context, int folderHash); static final String PREFERENCE_NAME; static final String HIDE_FOLDER_PREF_KEY; }