• <bdo id='WfD7f'></bdo><ul id='WfD7f'></ul>

    1. <tfoot id='WfD7f'></tfoot>
    2. <small id='WfD7f'></small><noframes id='WfD7f'>

      <i id='WfD7f'><tr id='WfD7f'><dt id='WfD7f'><q id='WfD7f'><span id='WfD7f'><b id='WfD7f'><form id='WfD7f'><ins id='WfD7f'></ins><ul id='WfD7f'></ul><sub id='WfD7f'></sub></form><legend id='WfD7f'></legend><bdo id='WfD7f'><pre id='WfD7f'><center id='WfD7f'></center></pre></bdo></b><th id='WfD7f'></th></span></q></dt></tr></i><div id='WfD7f'><tfoot id='WfD7f'></tfoot><dl id='WfD7f'><fieldset id='WfD7f'></fieldset></dl></div>
        <legend id='WfD7f'><style id='WfD7f'><dir id='WfD7f'><q id='WfD7f'></q></dir></style></legend>

        安卓:未知主机异常

        时间:2023-08-29

        <small id='cs0H7'></small><noframes id='cs0H7'>

        <tfoot id='cs0H7'></tfoot><legend id='cs0H7'><style id='cs0H7'><dir id='cs0H7'><q id='cs0H7'></q></dir></style></legend>

                  <tbody id='cs0H7'></tbody>
                • <bdo id='cs0H7'></bdo><ul id='cs0H7'></ul>

                  <i id='cs0H7'><tr id='cs0H7'><dt id='cs0H7'><q id='cs0H7'><span id='cs0H7'><b id='cs0H7'><form id='cs0H7'><ins id='cs0H7'></ins><ul id='cs0H7'></ul><sub id='cs0H7'></sub></form><legend id='cs0H7'></legend><bdo id='cs0H7'><pre id='cs0H7'><center id='cs0H7'></center></pre></bdo></b><th id='cs0H7'></th></span></q></dt></tr></i><div id='cs0H7'><tfoot id='cs0H7'></tfoot><dl id='cs0H7'><fieldset id='cs0H7'></fieldset></dl></div>
                  本文介绍了安卓:未知主机异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 Android SDK 2.2,使用模拟器测试我的应用程序.我想发送一个 HTTP Post.当我这样做时,我得到一个 UnknownHostException.我已放置所需的权限
                  >
                  在 manifest.xml 中.我也可以在模拟器上打开浏览器并毫无问题地导航到 URL.

                  I am using Android SDK 2.2, testing my application with the emulator. I want to send a HTTP Post. When I do I get a UnknownHostException. I have placed the required permissions
                  <uses-permission android:name="android.permission.INTERNET" />
                  in the manifest.xml. Also I can open the browser on the emulator and navigate to the URL with no problem.

                  这是我的代码:

                  HttpClient httpclient = new DefaultHttpClient();
                  HttpPost httppost = new HttpPost( uri );
                  HttpResponse response = null;
                  try
                  {
                  // Add your data
                  List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
                  2 );
                  nameValuePairs.add( new BasicNameValuePair( "id", "edit-name" ) );
                  nameValuePairs
                  .add( new BasicNameValuePair( "stringdata", userName ) );
                  httppost.setEntity( new UrlEncodedFormEntity( nameValuePairs ) );
                  
                  // Execute HTTP Post Request
                  response = httpclient.execute( httppost );
                  // Log.i( "HttpManager:", "======> response: "
                  // + response.getEntity().getContent() );
                  
                  }
                  catch (ClientProtocolException e)
                  {
                  Log.e( "HttpManager", "ClientProtocolException thrown" + e );
                  }
                  catch (IOException e)
                  {
                  Log.e( "HttpManager", "IOException thrown" + e );
                  }
                  

                  推荐答案

                  INTERNET 权限标签是清单标签的子标签,而不是应用标签.

                  The INTERNET permission tag is a child of the manifest tag, not the application tag.

                  这篇关于安卓:未知主机异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  <small id='yw2Fh'></small><noframes id='yw2Fh'>

                  <legend id='yw2Fh'><style id='yw2Fh'><dir id='yw2Fh'><q id='yw2Fh'></q></dir></style></legend>
                    <bdo id='yw2Fh'></bdo><ul id='yw2Fh'></ul>

                        <tbody id='yw2Fh'></tbody>

                        1. <tfoot id='yw2Fh'></tfoot>

                          <i id='yw2Fh'><tr id='yw2Fh'><dt id='yw2Fh'><q id='yw2Fh'><span id='yw2Fh'><b id='yw2Fh'><form id='yw2Fh'><ins id='yw2Fh'></ins><ul id='yw2Fh'></ul><sub id='yw2Fh'></sub></form><legend id='yw2Fh'></legend><bdo id='yw2Fh'><pre id='yw2Fh'><center id='yw2Fh'></center></pre></bdo></b><th id='yw2Fh'></th></span></q></dt></tr></i><div id='yw2Fh'><tfoot id='yw2Fh'></tfoot><dl id='yw2Fh'><fieldset id='yw2Fh'></fieldset></dl></div>