SoFunction
Updated on 2025-04-04

Android loading resource file instance code in assets

Android loading assets resources

In android, how to load folders under the assets directory? The method is very simple, use AssetManager, that is

  AssetManager assetManager = getAssets();  

Examples are as follows:

AssetManager assetManager = getAssets();   
  
     
    try {   
      String[] files = ("Files");   
  
      for(int i=0; i<;       
 
      { 
 
。。。。。。。 
       } 

Read the pictures under assets


try {  
       
      InputStream ims = ("android_logo_small.jpg");   
  
       Drawable d = (ims, null);   
  
      // set the drawable to imageview   
      (d);   

Thank you for reading, I hope it can help you. Thank you for your support for this site!