I made a code to display processes in android but when printing in a text view, it prints the PID, process name, cpu memory usage etc. the view stays that way
958 2 0% S 22 577164K 42624K bg u0_a63 com.snaptube.premium
I would like to print only "com.snaptube.premium"
I tried to use the split method but did not succeed
My code for showing processes is like this
p = Runtime.getRuntime().exec(command); // uso para utilizar comandos do linux
p.waitFor();
String line = ""; // string que contem a linha com as informações do processo
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
while ((line = reader.readLine()) != null) {
System.out.println(line);
output.append(line + "\n"); // impressao dos processos no textview
I created a string variable [] and assign it the line.lengh () - 1 and I used line.split ("") to separate the string by whitespace