title: How to get the size of the file array in android?
body: <p>I use this codes to get all Folders:</p>
  
  <pre><code> File MyDir[] = getExternalCacheDirs();
  </code></pre>
  
  <p>And then I use these code to show the path:</p>
  
  <pre><code>Toast.makeText(getApplicationContext(), MyDir[0].getPath(), Toast.LENGTH_LONG).show();
  Toast.makeText(getApplicationContext(), MyDir[1].getPath(), Toast.LENGTH_LONG).show();
  </code></pre>
  
  <p>However, I wonder how to get the length of the file list, so I can use the for-loop to show all path</p>
  
  <p>Like:</p>
  
  <pre><code>for (j = 0; j &lt;= &lt;size_of_the_list&gt;; j += 1) { 
   Toast.makeText(getApplicationContext(),MyDir[j].getPath(),Toast.LENGTH_LONG).show();
  }
  </code></pre>