Android 如何使用GET using WebView将脚本发送到URL

Android 如何使用GET using WebView将脚本发送到URL,android,webview,http-get,Android,Webview,Http Get,例如,我需要使用GET参数向URL发送脚本 是否可以在后台使用webview执行此操作,而不在屏幕上显示此代码 String urlString = "http://www.url.com/test2.php?actor=14"; this.web=new WebView(this.sc.getContext()); this.web.getSettings().setJavaScriptEnabled(true); this.w

例如,我需要使用GET参数向URL发送脚本

是否可以在后台使用webview执行此操作,而不在屏幕上显示此代码

        String urlString = "http://www.url.com/test2.php?actor=14";
        this.web=new WebView(this.sc.getContext());
        this.web.getSettings().setJavaScriptEnabled(true);
        this.web.loadUrl(urlString);
        return;
如您所见,webview没有添加到任何布局上,因此它对用户是透明的

这是实现这一目标的好方法吗

或者这是最好的选择

public static InputStream getInputStreamFromUrl(String url) {
  InputStream content = null;
  try {
    String url = "http://www.url.com/test2.php?actor=14";
    HttpClient httpclient = new DefaultHttpClient();
    HttpResponse response = httpclient.execute(new HttpGet(url));
    content = response.getEntity().getContent();
  } catch (Exception e) {
    Log.("[GET REQUEST]", "Network exception", e);
  }
    return content;
}

谢谢

否。您应该/可以使用HttpClient来实现这一点。WebView并不是用来处理那个用例的。在你的情况下,这是一个肮脏的黑客:-)我编辑,请检查它