Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从标准 Android 应用程序向 Android shell (BusyBox) 发送命令(并从其接收输出)。我该怎么做呢?谷歌搜索 1 小时没有结果。
非常感谢帮助。
问候, 斯万特
Process proc = Runtime.getRuntime().exec("ls -la");
这将执行ls -la命令并返回进程。如果您想要更复杂的交互,您应该使用输入和输出流:proc.getInputStream()和proc.getOutputStream()
ls -la
proc.getInputStream()
proc.getOutputStream()