title: How to run bash script from android activity
body: <p>I'm new android app developer<br>
  I want to know how to run a bash script from my android activity</p>
  
  <p>I did this that I found here</p>
  
  <pre><code>public void RunAsRoot(String[] cmds) {
      Process p = Runtime.getRuntime().exec("su");
      DataOutputStream os = new DataOutputStream(p.getOutputStream());            
      for (String tmpCmd : cmds) {
         os.writeBytes(tmpCmd+"\n");
      }           
      os.writeBytes("exit\n");  
      os.flush();
  }
  </code></pre>
  
  <p>but now I got a lot of errors like this:</p>
  
  <p><img src="https://i.stack.imgur.com/yv7Az.png" alt="http://i.stack.imgur.com/4N4KC.png"></p>