Así que quiero poder escribir una aplicación que pueda encender y mostrar mensajes de logcat, dmesg, y también poder ejecutar comandos como 'ls' ' cat '' echo '' cd. 'Android Runtime.getRuntime(). Exec() para navegación a través de directorios
Si hago lo siguiente:
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;
}
puedo poner el texto "lleno" a una vista de texto y ver el directorio raíz.
Sin embargo, eso es todo lo que puedo hacer. Digamos que quiero encontrar un directorio y cambiarlo, estoy teniendo problemas.
Así que si hago esto:
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;
}
/* Code here to confirm the existing of a directory*/
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;
}
no consigo nada para ambos "completos" y "texto"
¿Alguna idea?