0

I was making a program that uses a PHP page to connect to a database and then parse the information through JSON. The problem is, I get a RuntimeException on the AsyncTask responsible for the network comunications. I am using a physical android device for testing.

try {
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("URL");
    try {
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
        nameValuePairs.add(new BasicNameValuePair("password", "******"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Error appears on this line
        HttpResponse response = httpclient.execute(httppost);

        //JSON Parsing here

    }

    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
catch (Throwable t)
{
    CharSequence message = "Request failed: " + t.toString();
    Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
}
rdelfin
  • 819
  • 2
  • 13
  • 31

1 Answers1

0

**Just check where you have added the below Permission line in Android Manifest file. **

     <uses-permission android:name="android.permission.INTERNET" /> 

**It must be the child element of manifest tag. you might have added it under application tag. **

by reference: click

Community
  • 1
  • 1
SKK
  • 5,261
  • 3
  • 27
  • 39
  • Oh, sorry, it seems there is still a RuntimeException, but it no longer is telling me what exception is and the LogCat doesn't say anything. It just send me to debug mode – rdelfin Apr 26 '13 at 18:06