I want to run a Linux command in my Android app. I mean I'm an Android programmer and I want to commit a command in my codes in Java which I'm writing in Android Studio.
For example this is what I want in my codes in Java in Android Studio:
ImaginarylinuxClass.theFunctionWhichRunsTheCommands("sudo apt-get update && git clone && etc");
I hope I was able to say what I mean.
I tried to Google about it but it was all apps which they are Linux emulators like termux but it's not what I want actually.
Test this code man:
try {
Runtime.getRuntime().exec("cd sdcard/");
} catch (Exception e) {
showMessage(e.toString());
}
Replace "cd sdcard/" for your Linux commands...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.