android - 获取内部文件android
问题描述
我有一个 java 文件,其中包含这段代码来列出应用程序缓存目录中的文件,它运行良好。
String command[] = {"adb","shell","run-as",pack,"ls","cache/"};
Process process = Runtime.getRuntime().exec(command);
InputStream o_out = process.getInputStream(); //covert o_out to String to get the files name
现在我想让这段代码直接在android设备上运行,但它失败了,因为命令错误,知道吗?
解决方案
尝试这个:
String command[] = {"run-as",pack,"ls","cache/"};
推荐阅读
- django - Django 休息框架 + Angular 2
- asp.net - 主从显示数据 SQL
- matlab - 'isOctave' 或 'isMatlab' 等价物?
- javascript - 构造函数中的箭头函数和 this
- r - 合并未按预期工作:内部联接未返回第 1 列中的所有匹配行
- react-native - 地图缩放级别基于半径 React Native 地图
- angular - Angular Ionic 3 表单构建器自定义验证器不适用于电子邮件类型,但适用于文本类型
- javascript - 为什么我在 Django 应用程序中的 jquery 不起作用?
- javascript - reactjs正则表达式#xxx#
- javascript - 全局定义在 vue.js 中不起作用