URL="http://localhost:81/update.asp?u=1&f=23.33"
在网页上执行URL是成功的。URL的localhost换成外网IP也是可以执行的成功的。
网页中执行成功返回1,不成功返回2。在android中执行就是不行。
TextView1.setText(strResult); 
就没有值。有没有成功的实例。谢谢。

解决方案 »

  1.   

    public static String doGet(String reqUrl, String recvEncoding, int timeOut) { HttpURLConnection url_con = null;
    String responseContent = null;
    try {
    String queryUrl = reqUrl;
    Log.d("TAG", "doGet url is: " + reqUrl);
    URL url = new URL(queryUrl); url_con = (HttpURLConnection) url.openConnection(); url_con.setRequestMethod("GET");
    if (timeOut == 0) {
    url_con.setConnectTimeout(HttpUtil.connectTimeOut);

    url_con.setReadTimeout(HttpUtil.readTimeOut);

    } else {
    url_con.setConnectTimeout(timeOut);
    url_con.setReadTimeout(timeOut);
    }
    url_con.setDoOutput(false);
    url_con.setDoInput(true); InputStream in = url_con.getInputStream();
    BufferedReader rd = new BufferedReader(new InputStreamReader(in,
    recvEncoding));
    String tempLine = rd.readLine();
    StringBuffer temp = new StringBuffer();
    String crlf = System.getProperty("line.separator");
    while (tempLine != null) {
    temp.append(tempLine);
    temp.append(crlf);
    tempLine = rd.readLine();
    }
    responseContent = temp.toString();
    rd.close();
    in.close();
    } catch (IOException e) {
    e.printStackTrace();
    } finally {
    if (url_con != null) {
    url_con.disconnect();
    }
    } return responseContent;
    }
      

  2.   

    晚上试试,明天结账,用post怎么写?
      

  3.   

    不行,
    直接爆:Unfortunately,XXX has stopped.