Android HTTP请求在模拟器上失败

时间:2014-04-29 04:41:25

标签: android http android-fragments

我正在从Android模拟器请求HTTP请求,但它失败了..模拟器有什么问题吗? 我还启用了Manifest的互联网连接许可

  HttpClient Client = new DefaultHttpClient();

                // Create URL string

                 String URL = "http://androidexample.com/media/webservice/httpget.php?user="+loginValue+"&name="+fnameValue+"&email="+emailValue+"&pass="+passValue;

                //Log.i("httpget", URL);

               try
                {
                              String SetServerString = "";

                            // Create Request to server and get response

                              HttpGet httpget = new HttpGet(URL);
                             ResponseHandler<String> responseHandler = new BasicResponseHandler();
                             SetServerString = Client.execute(httpget, responseHandler);

                              // Show response on activity 

                             content.setText(SetServerString);
                 }
               catch(Exception ex)
                  {
                         content.setText("Fail!");
                   }
            }

我正在使用以下链接在模拟器上进行测试

http://androidexample.com/How_To_Make_HTTP_Get_Request_To_Server_-_Android_Example/index.php?view=article_discription&aid=63&aaid=88

0 个答案:

没有答案