本文整理匯總了Java中eu.chainfire.libsuperuser.Shell.OnCommandResultListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Shell.OnCommandResultListener方法的具體用法?Java Shell.OnCommandResultListener怎麽用?Java Shell.OnCommandResultListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eu.chainfire.libsuperuser.Shell
的用法示例。
在下文中一共展示了Shell.OnCommandResultListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: callBinary
import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
private void callBinary(final String params, final int flag,
final Shell.OnCommandResultListener listener) {
String command = binaryFile.getAbsolutePath() + " " + params;
if (BuildConfig.DEBUG)
Log.d(TAG, "command = " + command);
rootSession.addCommand(command, flag, listener);
}
示例2: runShellCommand
import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
/**
* Runs the command on an interactive shell. Provides a listener for the caller to interact.
* The caller is executed on a worker background thread, hence any calls from the callback
* should be thread safe.
* Command is run from superuser context (u:r:SuperSU0)
*
* @param cmd the command
* @param callback
* @return a list of results. Null only if the command passed is a blocking call or no output is
* there for the command passed
*/
public static void runShellCommand(String cmd, Shell.OnCommandResultListener callback)
throws ShellNotRunningException {
if (MainActivity.shellInteractive == null || !MainActivity.shellInteractive.isRunning())
throw new ShellNotRunningException();
MainActivity.shellInteractive.addCommand(cmd, 0, callback);
MainActivity.shellInteractive.waitForIdle();
}