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?
3 Answers
Use Runtime.exec to get a process, waitFor it to finish, and then read its output out of its output and error streams.
1 Comment
ademar111190
I'm getting "java.lang.ClassNotFoundException: android.os.Exec"
Different solutions could be found here: http://code.google.com/p/market-enabler/wiki/ShellCommands I've not tested them yet.
Comments
Try this answer there is way to run shell commands on android programmatically https://stackoverflow.com/a/3350332/2425851