如何在Android App中与shell(BusyBox)进行交互

时间:2011-01-08 14:27:48

标签: android shell busybox

我想从标准Android应用程序向Android shell(BusyBox)发送命令(并从中接收输出)。我该怎么做呢? 1小时的谷歌搜索没有产生任何结果。

非常感谢。

此致 斯万

1 个答案:

答案 0 :(得分:6)

Process proc = Runtime.getRuntime().exec("ls -la");

这将执行ls -la命令并返回该过程。如果您想要更复杂的交互,则应使用输入和输出流:proc.getInputStream()proc.getOutputStream()