Hi guys,
I'm working on a G1 rooted. I have to implement program that execute "Root
explorer".
I have write this code :
Process p;
try {
p = Runtime.getRuntime().exec("su");
// OK
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("echo \"HELLO!!!!!!!!\" >/system/test.txt\n");
os.writeBytes("exit\n");
os.flush();
//////////////////////////////////////
// ERROR
File dir = new File("/data");
String [] list = dir.list();
Log.v("TEST]", String.valueOf(list.length));
////////////////////////////////////////////////////
try {
p.waitFor();
int exit = p.exitValue();
if (exit != 255) {
Log.v("TEST]", "ok");
}
else {
Log.v("TEST]", "Error");
}
} catch (Exception e) {
Log.v("TEST]",e.getMessage());
}
} catch (Exception e) {
Log.v("TEST]",e.getMessage());
}
I use Superuser.apk for execute "su" command. My program write file test.txt
in /system but statement Log.v("TEST]", String.valueOf(list.length)); return
value 0.
Please, can anyone help me?
Thanks,
Francesco
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---