title: Root file listing: What's wrong with Runtime.getRuntime().exec("ls /data");?
body: <p>As you can see, I am building a simple Root explorer app with this code:</p>
  
  <pre><code> @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      if(!(requestRoot())) 
          Toast.makeText(this.getActivity(), "Could Not Get Root!", Toast.LENGTH_SHORT).show();
      else
          Toast.makeText(this.getActivity(), "Root Found!", Toast.LENGTH_SHORT).show();
  
      getDir("/");      //=&gt;OK
      getDir("/data");  //=&gt;NOT OK
      getDir("/data/"); //=&gt;NOT OK
  }
  
  private void getDir(String dirPath)
  {
      getActivity().getActionBar().setTitle("Location: " + dirPath);
  
      item = new ArrayList&lt;String&gt;();
  
      try {
          Process p = Runtime.getRuntime().exec("ls "+dirPath);
          BufferedReader in = new BufferedReader(
                  new InputStreamReader(p.getInputStream()));
          String line;
          while ((line = in.readLine()) != null) {
              item.add(line);
              Log.e(dirPath, dirPath +" =&gt; "+ line);
          }
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>The problem is that <code>getDir("/");</code> gives me all the expected results (a list of files including data) but <code>getDir("/data");</code> doesn't give any result or error...</p>
  
  <p>Thank a lot for any clue on what is the problem.</p>
  
  <p>EDIT:
  I have also tried </p>
  
  <blockquote>
    <p>Process p = Runtime.getRuntime().exec("sudo ls /data");</p>
  </blockquote>