首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

手机运作命令行

2012-08-28 
手机运行命令行这个死为测试版的 有真机的可以测试一下告诉我结果 谢谢try {?? ? ?Runtime rt Runtime.g

手机运行命令行

这个死为测试版的 有真机的可以测试一下告诉我结果 谢谢

try {?
? ? ?Runtime rt = Runtime.getRuntime();?
? ? ?Process pcs = rt.exec("ls -l? /data/data/your_package");?
? ? ?BufferedReader br = new BufferedReader(new InputStreamReader(pcs?
? ? ? ? ? ?.getInputStream()));?
? ? ?String line = null;?
? ? ?while ((line = br.readLine()) != null) {?
? ? ? ? Log.e("line","line="+line);?
? ? ?}?
? ? ?br.close();?
? ? ?pcs.waitFor();?
? ? ?int ret = pcs.exitValue();?
? ? ?Log.e("ret","ret="+ret);?
? } catch (Exception e) {?
? ? ?Log.e("Exception", "Exception", e);?
? }?

热点排行