title: Incompatible type: String cannot be converted to File
body: <pre><code>   GridView gv;
     ArrayList&lt;File&gt; list;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_yearbook);
  
      list = imageReader (Environment.getExternalStorageDirectory().getAbsolutePath() + "/Mypath");
  
      gv = (GridView) findViewById(R.id.ImageGV);
      gv.setAdapter(new GridAdapter());
  }
  
  
  ArrayList&lt;File&gt; imageReader(File root) {
  
      ArrayList&lt;File&gt; a = new ArrayList&lt;&gt;();
  
      File[] files = root.listFiles();
      for (int i =0; i&lt; files.length; i++) {
          if (files[i].isDirectory()) {
              a.addAll(imageReader(files[i]));
          }
          else {
              if ( files[i].getName().endsWith(".jpg")) {
                  a.add(files[i]);
              }
          }
      }
  
      return a;
  }
  </code></pre>
  
  <p>So i was trying to make my <code>imageReader</code> read a certain directory in my <code>sdcard</code> to show a array of images in my program. However i encountered an error on the line <code>list = imageReader (Enviroment.getExternalStorageDirecctory().getAbsolutePath() + "/Mypath");</code>, it says that  <code>java.io.file</code> cannot be converted to <code>java.io.string</code>. How do i fix this, i googled for hours and i cant really find a solution to it</p>