0

I'm currently writing a android app that executes su commands and I would like to print the output of that commands to a toast my code looks like this

try {

Runtime.getRuntime().exec("su -c rm -rf /data/cache");

} catch (Exception e ) {

}

But I found nothing and I have no idea how to do it so any help would be appreciated.

PiRocks
  • 1,708
  • 2
  • 18
  • 29
FBI
  • 1
  • What do you mean by toast? – PiRocks Jun 10 '20 at 04:34
  • sorry i mean this little popup that appears at the bottom i hope you understand it – FBI Jun 10 '20 at 05:19
  • 3
    Does this answer your question? [Execute shell commands and get output in a TextView](https://stackoverflow.com/questions/23608005/execute-shell-commands-and-get-output-in-a-textview) – PiRocks Jun 12 '20 at 00:00

2 Answers2

0

Save the commands output to a string and Just type Toast and push tab button to auto complete. You can put your text or a string file there. Is this clearing your problem?

Nitin Tej
  • 353
  • 1
  • 7
  • thanks for your answer but is a guide guide for this? i'm pretty new to android applications – FBI Jun 10 '20 at 05:21
  • you always have to go to documentation to check first then blogs and then stackoverflow if you are getting doubts – Nitin Tej Jun 10 '20 at 05:28
0

Try this answer on Stack Overflow.

Get su output into textview

It get the output as a String and set it in a TextView. I think you also can obtain that String and set it as a Toast.

KalanaChinthaka
  • 323
  • 4
  • 13