How to acquire root access using shell script in Java code?
<p>I can get root access to phone using 'adb root' in my PC then change a file content under /data folder. Now I want to do it in a apk using Java code.
I tried blow code:</p>

<pre><code>Runtime.getRuntime().exec(new String[]{"sh", "/sdcard/my.sh"});
</code></pre>

<p>This function works well when shell command do not need a root permission.
Now I change my.sh into</p>

<pre><code>su root
chmod 777 /data/filetochange.xml
rm -r /data/filetochange.xml
</code></pre>

<p>But it didn't work. Can I do this in Java code?</p>
