AssetManager list - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AssetManager list method.

This code example shows how to use the following methods:list
    public void assetsPathListing() throws IOException { 
        List<String> files;
        String testPath;
 
        testPath = "";
        files = Arrays.asList(assetManager.list(testPath));
        assertTrue(files.contains("docs"));
        assertTrue(files.contains("assetsHome.txt"));
 
        testPath = "docs";
        files = Arrays.asList(assetManager.list(testPath));
        assertTrue(files.contains("extra"));
 
        testPath = "docs" + sp + "extra";
        files = Arrays.asList(assetManager.list(testPath));
        assertTrue(files.contains("testing"));
 
        testPath = "docs" + sp + "extra" + sp + "testing";
        files = Arrays.asList(assetManager.list(testPath));
        assertTrue(files.contains("hello.txt"));

5
CodeRank
This code example shows how to use the following methods:list
String[] srcSubPaths = null;
         
        try 
        { 
            srcSubPaths = assetManager.list( srcPath );
        } 
        catch( IOException e )
        { 
            Log.w( "AssetExtractor", "Failed to get asset file list." );
        } 
         
        return srcSubPaths;
    } 
} 
5
CodeRank
This code example shows how to use the following methods:list
        //Now delete 
        zFile.delete();
    } 
 
    public boolean isAssetDirectory(String zAssetPath) throws IOException{
        String[] files = mAssets.list(zAssetPath);
        if(files==null || files.length==0){
            return false; 
        } 
        return true; 
    } 
 
    private String getPathName(String zPath){
        int index = zPath.lastIndexOf("/");
        if(index==-1){
            return zPath;
        } 
        return zPath.substring(index);
    } 
 
4
CodeRank
This code example shows how to use the following methods:list
			 
			//set visibility && url 
			//ÀˬdÀɮ׬O§_¦s¦b 
			if(wi.code!=oldcode){
				try { 
					mapList = Arrays.asList(am.list(wi.code));
				} catch (IOException e) {
					// TODO Auto-generated catch block 
					e.printStackTrace();
					Log.e("","Assets List has error\n");
				} 
				if(mapList.contains("1")){
					imageview1.setVisibility(wi.visible1);
					imageview1.setImageBitmap(getImageFromAssetsFile(wi.code+"/1/pic.jpg"));
				} 
				else 
					imageview1.setVisibility(View.GONE);
				if(mapList.contains("2")){
					imageview2.setVisibility(wi.visible2);
					imageview2.setImageBitmap(getImageFromAssetsFile(wi.code+"/2/pic.jpg"));
4
CodeRank
This code example shows how to use the following methods:list
	/** 
	 * Laad de lijst met puzzels door in de map puzzles te kijken 
	 */ 
	public void checkAssets(String path){ 
		try { 
			puzzles = assetManager.list(path); 
			puzzleAdapter.clear(); 
			puzzleAdapter.addAll(puzzles); 
			listView.setAdapter(puzzleAdapter); 
		}  
		catch (IOException e) { 
			Log.e(TAG, "Something went wrong whilst scanning for puzzles."); 
		} 
	} 
	 
	/** 
	 * Open de puzzel door een String waarde mee te geven aan de PuzzleActivity 
	 * @param puzzle De naam van de starten puzzel 
	 */ 
	public void openPuzzleView(String puzzleName, String puzzlePath){ 
4
CodeRank
This code example shows how to use the following methods:list
			puzzles = assetManager.list(path);
			puzzleAdapter.clear();
			puzzleAdapter.addAll(puzzles);
			listView.setAdapter(puzzleAdapter);
		}  
		catch (IOException e) {
			Log.e(TAG, "Something went wrong whilst scanning for puzzles.");
		} 
	} 
	 
	/** 
	 * Open de puzzel door een String waarde mee te geven aan de PuzzleActivity 
	 * @param puzzle De naam van de starten puzzel 
	 */ 
	public void openPuzzleView(String puzzleName, String puzzlePath){
		Intent intent = new Intent(this, PuzzleActivity.class);
		intent.putExtra("puzzleName", puzzleName);
		intent.putExtra("puzzlePath", puzzlePath);
		startActivity(intent);
	} 
4
CodeRank
This code example shows how to use the following methods:list
		startActivity(intent);
	} 
	 
	/** 
	 * Detecteer welke puzzel is aangeklikt en handel deze af in OpenPuzzleView 
	 */ 
	private OnItemClickListener puzzleClickedHandler = new OnItemClickListener() {
	    public void onItemClick(AdapterView<?> parent, View v, int position, long id) { 
	    	openPuzzleView(puzzles[position], "puzzles" + File.separator + categories[position] + File.separator + puzzles[position]); 
	    } 
	}; 
 
} 
4
CodeRank
This code example shows how to use the following methods:list
		} 
		return curr;	}
 
 
	public void buildFiles(AssetManager assetManager, AssetManagerFile baseDir) throws IOException {
        String[] fileList = assetManager.list(baseDir.getInternalPath());
 
        if (fileList == null || fileList.length == 0) {
	        // baseDir must be a file 
	        baseDir.setDirectory(false);
            return; 
        } 
 
        baseDir.setDirectory(true);
        for (String file: fileList) {
            AssetManagerFile assetManagerFile = new AssetManagerFile(assetManager, WEB_ROOT, baseDir.getPath(), file);
	        baseDir.addEntry(assetManagerFile);
            buildFiles(assetManager, assetManagerFile);
        } 
    } 
4
CodeRank
This code example shows how to use the following methods:list
	} 
 
	@Override 
	public String[] getFileList(String path) {
		try { 
			return assetManager.list(path);
		} catch (IOException e) {
		} 
		return null; 
	} 
 
	@Override 
	public long getSize(String name) {
		try { 
			return this.assetManager.openFd(name).getLength();
		} catch (IOException e) {
		} 
		return 0; 
	} 
 
4
CodeRank
This code example shows how to use the following methods:list, open
	 
	public static String[] List(AssetManager am, String uri){
		uri = RemoveLastPathSeperator(uri);
		if ( IsFolder(am, uri) ){
			try { 
				return am.list(uri);
			} catch (IOException e) {
				return null; 
			} 
		} else { 
			return null; 
		} 
	} 
	 
	public static boolean IsFolder(AssetManager am, String uri){
		uri = RemoveLastPathSeperator(uri);
		try { 
	 		 
			InputStream is = am.open(uri);
			if ( am.open(uri) == null ){

5
CodeRank

Related AssetManager list Questions & Answers:

list Method Overview
Return a String array of all the assets at the given path.
See Code Examples for other Android AssetManager Methods: