UnKnownHostException in Http Post of Android Application
<p>In Http Post, the values are not send to server. I got <strong>unknownhostexception</strong> at following line.<code>HttpResponse rs=httpclient.execute(httppost);</code></p>

<p><strong>http Coding:</strong></p>

<pre><code>          HttpClient httpclient=new DefaultHttpClient();

          HttpPost httppost=new HttpPost("http://www.mysite.com/fasttrack/androidapps.php");


          httppost.setEntity(new UrlEncodedFormEntity(data));

          appendLog("7)Value Encoded to url successfully");


      HttpResponse rs=httpclient.execute(httppost); // unknownhostexception got
</code></pre>

<p>I added     <code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt;</code>  in Manifestfile also...</p>

<p>Note : this codings works fine before I added log file codings...</p>

<p><strong>my Log File coding is below:</strong></p>

<pre><code>public void appendLog(String text)
        {      
            //File logFile = new File("alog.txt");
           File logFile = new File("sdcard/alog.file");
           if (!logFile.exists())
           {
              try
              {
                 logFile.createNewFile();
              } 
              catch (IOException e)
              {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
              }
           }
           try
           {
              //BufferedWriter for performance, true to set append to file flag
              BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true)); 
              buf.append(text);
              buf.newLine();
              buf.close();
           }
           catch (IOException e)
           {
              // TODO Auto-generated catch block
              e.printStackTrace();
           }
        }   
</code></pre>
