Wait for the command to complete in RootTools

I use the RootTools library to execute some shell commands in my Android application.

However, I need to wait for the completion of the commands before continuing. The documentation shows a method waitForFinish()that is at least not available in the latest version of the library.

How would I do this behavior?

+4
source share
1 answer

This work for me: First you have to enter the command without turning on handler(with false):

Command command = new Command(0, false, "cat")

Then do the following:

         RootTools.getShell(true).add(command);
         while (!command.isFinished()) 
         {
                try
                {
                    Thread.sleep(50);
                } 
                catch (InterruptedException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

         }
+1
source

All Articles