List of usage examples for android.content.res AssetManager list
public @Nullable String[] list(@NonNull String path) throws IOException
From source file:Main.java
public static String[] listFiles(AssetManager assets, String subdir) { try {/* w ww .java2s . c om*/ return assets.list(subdir); } catch (IOException e) { return new String[0]; } }
From source file:Main.java
public static final boolean assetsIsDirectory(AssetManager assetManager, String path) { try {// w ww. ja va2 s. com if (assetManager.list(path) != null && assetManager.list(path).length > 0) { return true; } } catch (IOException e) { // nothing } return false; }
From source file:Main.java
/** * To get all file inside folder/*from w w w.j a v a 2 s .c o m*/ * * @return String[] */ public static String[] getFileName(Context context, String folderName) { String[] files = null; try { AssetManager assetManager = context.getAssets(); files = assetManager.list(folderName); } catch (IOException e1) { } return files; }
From source file:Main.java
public static String[] getFolders(AssetManager mgr) { String[] fileNames;//from w ww .ja v a2 s . co m try { fileNames = mgr.list(MainPath); return fileNames; } catch (IOException e) { e.printStackTrace(); return new String[0];//To change body of catch statement use File | Settings | File Templates. } }
From source file:Main.java
public static String[] list(String path, AssetManager assetManager) throws IOException { String[] files = assetManager.list(path); Arrays.sort(files);// w w w.j a va2s . c o m return files; }
From source file:Main.java
/** * Parcourt les fichiers dans /assets/ et renvoie la liste des fichiers dont leurs noms est * de la forme suivante : XXX____gallery_borneathXXX X pouvant etre une chaine de caracteres * vide/* www . j a v a 2s. c om*/ * @param context utilisee * @return liste de chaine de caracteres (nom d'image) * @throws IOException */ public static List<String> getImagesPathFromAssets(Context context) throws IOException { AssetManager assetManager = context.getAssets(); String[] files = assetManager.list(ASSETS_IMAGES_FOLDER); List<String> sortedFileNames = new ArrayList<>(); for (String fileName : files) { if (fileName.contains(ASSETS_PATH_NAME_PATTERN)) { sortedFileNames.add(ASSETS_IMAGES_FOLDER + FILE_SEPARATOR + fileName); } } return sortedFileNames; }
From source file:Main.java
private static String[] listAssetFiles(String path, Context applicationContext) throws IOException { AssetManager assetManager = applicationContext.getAssets(); String[] listOfFonts = assetManager.list(path); return listOfFonts; }
From source file:Main.java
public static boolean exists(String fileName, String path, AssetManager assetManager) throws IOException { for (String currentFileName : assetManager.list(path)) { if (currentFileName.equals(fileName)) { return true; }/*from w w w. j a v a 2 s . c o m*/ } return false; }
From source file:Main.java
public static void copyAssetDirToFiles(Context context, String root, String dirname) throws IOException { File dir = new File(root + "/" + dirname); dir.mkdir();// w w w .j a v a 2 s .co m AssetManager assetManager = context.getAssets(); String[] children = assetManager.list(dirname); for (String child : children) { child = dirname + '/' + child; String[] grandChildren = assetManager.list(child); if (0 == grandChildren.length) copyAssetFileToFiles(context, root, child); else copyAssetDirToFiles(context, root, child); } }
From source file:Main.java
public static boolean exists(AssetManager assetManager, String directory, String fileName) throws IOException { final String[] assets = assetManager.list(directory); for (String asset : assets) if (asset.equals(fileName)) return true; return false; }