Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将命令从我的android应用程序发送到android终端模拟器?_Android - Fatal编程技术网

如何将命令从我的android应用程序发送到android终端模拟器?

如何将命令从我的android应用程序发送到android终端模拟器?,android,Android,我想将命令从我的Android应用程序发送到Android终端模拟器 下面是我的代码 public void onClick(View p1) { // TODO: Implement this method Intent i=new Intent(Intent.ACTION_SEND); i.setType("*/*"); i.setPackage("jackpal.androidterm"); i.putExtra(Intent.EXTRA_TEXT,

我想将命令从我的Android应用程序发送到Android终端模拟器

下面是我的代码

public void onClick(View p1)
{
    // TODO: Implement this method
    Intent i=new Intent(Intent.ACTION_SEND);
    i.setType("*/*");
    i.setPackage("jackpal.androidterm");
    i.putExtra(Intent.EXTRA_TEXT,"date");
    startActivity(i);
}

要执行shell命令,您不需要终端仿真器应用程序。Android基于Linux内核,因此您可以直接执行shell命令

试试这个代码

// Command to execute
String command = "date";
ShellExecuter exe = new ShellExecuter();
String outp = exe.Executer(command);
out.setText(outp);
Log.d("Output", outp);

问题在哪里???????