本帖最后由 ddddfpxx1 于 2014-03-26 18:04:51 编辑

解决方案 »

  1.   

    我之前有碰到过网络不好时,有些机型是会报connection xxx refused。
    你是一直被refuse吗?你试试其他的post好不好,或者看看是不是参数的原因。
      

  2.   

    下面是代码,看不出什么毛病啊!private OnClickListener listener=new OnClickListener(){
    @Override
    public void onClick(View v){
        String action="http://192.168.0.11/android/save.php";
        HttpPost httpRequest=null;
        List <NameValuePair> params=null;
        HttpResponse httpResponse;
        if(sendBtn==v){
        try {
            httpRequest=new HttpPost(action);
            params=new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("name",name.getText().toString()));
    params.add(new BasicNameValuePair("pass",pass.getText().toString()));
    httpRequest.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8)); 
    httpResponse=new DefaultHttpClient().execute(httpRequest); if(httpResponse.getStatusLine().getStatusCode()==200){
              String strResult=EntityUtils.toString(httpResponse.getEntity());
              showDialog("info",strResult);
    }else{
    showDialog("Error",httpResponse.getStatusLine().toString());
    }
    }
    catch (Exception e){ 
    showDialog("Exception",e.getMessage().toString());

    }
    }
    };