Process process = null;
DataOutputStream os = null;
try {String command = "chmod 777 " + "data";
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
} finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
}
}
这样可以访问data文件夹
DataOutputStream os = null;
try {String command = "chmod 777 " + "data";
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
} finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
}
}
这样可以访问data文件夹
解决方案 »
- android googlemap 單一button事件問題 跪求大大解答(有圖片)
- 一个格式转换的问题。
- 关于android程序死掉的问题
- socket传递字符流等待问题
- startActivityForResult() 和 onActivityResult()
- android音乐播放器乱码问题!!
- 求解,android中listview的items同时添加edittext和checkbox的问题
- 急!求例子!!!
- android调用IKAnalyzer分词器出现内存溢出情况,求大神解决
- android 华为手机广播注册过多!
- 关于项目中要使用大量图片至内存溢出问题讨论
- sqlite多次删除记录的问题?
String[] command={"su","-c","/data"}
Process=Runtime.getRuntime().exec(command);
process.waitfor();
os = new DataOutputStream(process.getOutputStream());不知道这样行不行了~