有没有方法在不root手机的情况下读取Data目录下的文件

网上有代码是这样的:
public void execMethod(){
String line ="";
String args[] = new String[3];

args[0] = "chmod";

args[1] = "777";

args[2] ="/data/data/com.eoemobile/databases/webviewCache.db";

try
{
Process process = Runtime.getRuntime().exec(args);

//get the err line

InputStream stderr = process.getErrorStream();
InputStreamReader isrerr = new InputStreamReader(stderr);
BufferedReader brerr = new BufferedReader(isrerr);

//get the output line
InputStream outs = process.getInputStream();
InputStreamReader isrout = new InputStreamReader(outs);
BufferedReader brout = new BufferedReader(isrout);

String errline = null;

String result = "";



// get the whole error message string while ( (line = brerr.readLine()) != null)
{
result += line;
result += "\n";


}

if( result != "" )

{

// put the result string on the screen

}

// get the whole standard output string

while ( (line = brout.readLine()) != null)
{
result += line;
result += "\n";
}
if( result != "" )
{

System.out.println(result);

}

}catch(Throwable t)
{
t.printStackTrace();
}
}

但是这个代码我没有运行成功,也看不明白,求指教?

更多相关文章

  1. android OSChina 客户端源代码剖析
  2. Android 中文件类型与MIME的匹配表
  3. Android:无法在同一部手机上执行通过Linux部署编译的文件
  4. 多个dex文件定义了Landroid/支持/v13/app/FragmentCompatICS。
  5. android代码混淆 GSON完满解决
  6. Android开源代码解读の地图照片应用Panoramio的实现详解(六)
  7. 在app引擎端点的启动时执行代码
  8. 解决:AndroidStudio 下使用AIDL不能生成对应java文件
  9. 尽管在清单文件中指定了权限,但是ACCESS_FINE_LOCATION SecurityE

随机推荐

  1. CSS:浮动时忽略div高度
  2. asp.net core,返回一个view,并没有正确的
  3. Web项目中使用RDLC报表可以打印吗?
  4. Bootstrap 4:导航内部的多级下拉
  5. JQuery TextArea的取值与赋值问题
  6. HTML5_旋转轮播-电子相册-新startMove函
  7. HTML5爱好者QQ群创建啦,欢迎大家来Q群讨论
  8. 如何在不使用Bootstrap CSS的情况下包含G
  9. Emmet插件快速编写html小技巧
  10. HTML5获取手机摄像头拍照