菜鸟 调用ROOT 基础版
本帖最后由 djwdj 于 2017-10-29 14:02 编辑在java的class下面加入
void su(String su){
try
{
java.lang.Process p = Runtime.getRuntime().exec("su");
DataOutputStream o = new DataOutputStream(p.getOutputStream());
o.writeBytes(new StringBuffer().append(su).append("\n").toString());
o.writeBytes("exit\n");
o.flush();
StringBuilder i = new StringBuilder(),e = new StringBuilder();
BufferedReader
in = new BufferedReader(new InputStreamReader(p.getInputStream())),
er = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String s;
while ((s = in.readLine()) != null)
{
i.append(s);
}
while ((s = er.readLine()) != null)
{
e.append(s);
}
p.getErrorStream().close();
}catch (IOException e){}
}
表示看不懂啊。。。我真是菜鸟 wuai920981023 发表于 2017-10-29 14:27
表示看不懂啊。。。我真是菜鸟
会编程不?不会就不教了。
页:
[1]