我试图在 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;
}
}