JAVA-SHELL commands, save results into a variable

Hi,

I am using Shell commands to program my own app in JAVA with Android Studio, I will set some GPIO as input and also I need get the data strings from the ttyS0.

I tryed with adb Shell: cat - v /dev/ttyS0 And I am getting data properly, now I’ll need to know,

  • How can I save this data to a variable in JAVA and then use it in my code?

Thanks!

Solved, you need to create a string with the file data