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