有没有方法在不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();
}
}
但是这个代码我没有运行成功,也看不明白,求指教?