So, I want to write an application that can include and display logcat, dmesg messages, and also be able to run commands like 'ls' 'cat' 'echo' 'cd.'
If I do the following:
nativeProc = Runtime.getRuntime().exec("ls\n"); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(nativeProc.getOutputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(nativeProc.getInputStream())); String line = null; while ((line = in.readLine()) != null) { full = full + "\n" + line; }
I can put the text "full" in the text view and see the root directory.
However, about all that I can do. Say I want to find a directory and change it, I have problems.
So, if I do this:
nativeProc = Runtime.getRuntime().exec("ls\n"); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(nativeProc.getOutputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(nativeProc.getInputStream())); String line = null; while ((line = in.readLine()) != null) { full = full + "\n" + line; } nativeProc = Runtime.getRuntime().exec("cd tmp\n"); BufferedReader in2 = new BufferedReader(new InputStreamReader(nativeProc.getInputStream())); line = null; String test = "\nStart1:\n"; while ((line = in2.readLine()) != null) { test = test + "\n" + line; }
I get nothing for "full" and "text"
Any ideas?
Andi jay
source share