2011년 2월 10일 목요일

anddev.org • View topic - root access snippet

anddev.org • View topic - root access snippet

TextView tv = (TextView) findViewById(R.id.test);

Process p;
try {
p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("echo "Hi Mom!!!!!!!!" >/system/sd/ciccio.txtn");
os.writeBytes("exitn");
os.flush();
try {
p.waitFor();
if (p.exitValue() != 255) {
tv.setText("OK!");
}
else {
tv.setText("Error");
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

댓글 없음:

댓글 쓰기