title: android find external folders through mnt
body: <p>Let me get this out of the way; I am a beginner to java, I research the code I need and try to learn it while using it in my app.</p>
  
  <p>I am currently stuck, not really sure how I can continue, ANY help is greatly appreciated.
  I am trying to look in the /mnt/ folder for any folder with 'ext' or 'sd' in the file name. This is what I have so far, it gets me a null pointer exception but I don't know what variable is null.</p>
  
  <pre><code>public class MainActivity extends Activity
  {
      static File[] dirs;
      @Override
      public void onCreate(Bundle savedInstanceState)
          {
          this.requestWindowFeature(Window.FEATURE_NO_TITLE);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          findMnt("/mnt/");
          AlertDialog builder = new AlertDialog.Builder(this).setTitle("AppName").setMessage(dirs[0].getPath()).setNeutralButton("Close", null).show();
          AlertDialog builder2 = new AlertDialog.Builder(this).setTitle("AppName").setMessage(dirs[1].getPath()).setNeutralButton("Close", null).show();
  }
      public static void findMnt(String path) {
          File file = new File(path);
          if(file.exists()){
              File[] list = file.listFiles();
              for(int i=0; i&lt;list.length; i++) {
                  if(list[i].isDirectory()) {
                      if(list[i].getPath().contains("sd") || list[i].getPath().contains("ext")){
                          for(int b=0; b&lt;list.length; b++){
                              dirs[b] = new File(list[i].getPath());
                          }
                      }
                  }
              }
          }
      }
  </code></pre>