Reading respose from a command called at runtime Issue
<p>I have the following code.</p>

<pre><code>public ArrayList&lt;String&gt; doCommand(String[] commands)
{

    ArrayList&lt;String&gt; output = new ArrayList&lt;String&gt;();

    try
    {

        Process process = Runtime.getRuntime().exec("su");
        DataOutputStream os = new DataOutputStream(process.getOutputStream());  
        DataInputStream ins = new DataInputStream(process.getInputStream());
        for (String single : commands) 
        {
            os.writeBytes(single + "\n");
            //os.flush();


            output.add("true");
        }
        os.writeBytes("exit\n");


        byte[] bc = new byte[10000];
        String st = "";
        while(ins.read(bc) != -1)
        {
        st += new String(bc);

        }
        output.add(st);


        os.flush();
        os.close();
        ins.close();
        process.waitFor();          
    }
    catch(Exception ex)
    {}

    return output;
}
</code></pre>

<p>With this I call the method I call</p>

<pre><code>String[] commands = new String[]{"ls /system/app"};
String s = doCommand(commands).get(commands.length);
</code></pre>

<p>s should now be a string consisting of all the information about all the apps on system/app int the form of "ap1.apk\nap2.apk\n...ap50.apk\n"</p>

<p>However I only get half the information "ap1.apk\nap2.apk\n...ap24.apk\nap2"</p>

<p>Can anyone tell me what im doing wronge do I need to do something special to get the ouputStream to see the rest?</p>
