4

Im trying to connect mysql with android but it throw me an error. Error in http connection java.net.UnknownHostException:

Below is my code:

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.pherma.net84.net/admin/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();

But the URL s working fine. Please copy n paste the url.

3
  • 3
    Does the internet connection of your device work correctly? And do you have specified the 'internet' permission in your AndroidManifest? Commented May 21, 2012 at 11:59
  • remove this line httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); Commented May 21, 2012 at 13:21
  • its works now...my bad....didnt give network permission in manifes Commented May 22, 2012 at 6:20

1 Answer 1

4

I forget to put network permission in manifest. Working fine now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.