Java 可以在UI Automator Android中进行API调用吗

Java 可以在UI Automator Android中进行API调用吗,java,android,ui-automation,android-uiautomator,Java,Android,Ui Automation,Android Uiautomator,我尝试在UI Automator android中进行api调用。我的代码贴在下面。我们可以这样调用API吗: String enter_url = "www.abc.com"; new UiObject(new UiSelector().text("Enter URL or Search & Win")).setText(enter_url); getUiDevice().click(745, 969); //calling check class

我尝试在UI Automator android中进行api调用。我的代码贴在下面。我们可以这样调用API吗:

    String enter_url = "www.abc.com";
    new UiObject(new UiSelector().text("Enter URL or Search & Win")).setText(enter_url);
    getUiDevice().click(745, 969);

    //calling check class
    new check().execute(enter_url);     

//AsyncTask 
private class check extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... args) {
        String myurl = args[0];

          //making api call here


    // the json string is stored here
        String result = sb.toString();
        System.out.println("Result is :" + result);
        return result;  

    }   
}
String输入\u url=“www.abc.com”;
新建UiObject(新建UiSelector().text(“输入URL或搜索并赢”).setText(输入URL);
getUiDevice()。单击(745969);
//调用检查类
新检查()。执行(输入url);
//异步任务
私有类检查扩展了异步任务{
@凌驾
受保护的字符串doInBackground(字符串…args){
字符串myurl=args[0];
//在此处进行api调用
//json字符串存储在这里
字符串结果=sb.toString();
System.out.println(“结果为:”+Result);
返回结果;
}   
}

我很确定你不能

如果您有root用户,您可以通过和Android应用程序调用UiAutomator: