title: How to get all files from assets folder
body: <p>I am trying to get all images in my assets folder using the codes below</p>
  
  <pre><code>private List&lt;String&gt; getImage()
        {
          /* 设定目前所在路径 */
          List&lt;String&gt; it=new ArrayList&lt;String&gt;();      
          File f=new File("file:///android_asset/");  
          File[] files=f.listFiles();
          Log.d("tag", "读取asset资源");
  
          /* 将所有文件存入ArrayList中 */
          for(int i=0;i&lt;files.length;i++)
          {
            File file=files[i];
            if(getImageFile(file.getPath()))
              it.add(file.getPath());
          }
          return it;
  
        }
  
        private boolean getImageFile(String fName)
        {
          boolean re;
  
          /* 取得扩展名 */
          String end=fName.substring(fName.lastIndexOf(".")+1,
                        fName.length()).toLowerCase(); 
  
          /* 按扩展名的类型决定MimeType */
          if(end.equals("jpg")||end.equals("gif")||end.equals("png")
                  ||end.equals("jpeg")||end.equals("bmp"))
          {
            re=true;
          }
          else
          {
            re=false;
          }
          return re; 
        }
  </code></pre>
  
  <p>somehow I am not sure about this expression</p>
  
  <pre><code>File f=new File("file:///android_asset/"); 
  </code></pre>
  
  <p>Well, I know that when read a txt file or html file from assets folder you can use this,but would images accept this too?</p>
  
  <p>I have resolve this problem by using the code below</p>
  
  <pre><code>private List&lt;String&gt; getImage() throws IOException
        {
          AssetManager assetManager = getAssets();
          String[] files = assetManager.list("image");   
          List&lt;String&gt; it=Arrays.asList(files);
          return it; 
  
          }
  </code></pre>
  
  <p>in case somebody else want to know</p>