Reputation: 1231
How to send a command to the terminal through android app and get the output back? For example, sending "ls /" and getting the output to print it in the GUI?
Upvotes: 16
Views: 31940
Reputation: 2564
Use Runtime.exec to get a process, waitFor it to finish, and then read its output out of its output and error streams.
Upvotes: 13
Reputation: 12887
Try this answer there is way to run shell commands on android programmatically https://stackoverflow.com/a/3350332/2425851
Upvotes: 1
Reputation: 1231
Different solutions could be found here: http://code.google.com/p/market-enabler/wiki/ShellCommands I've not tested them yet.
Upvotes: 1