I am creating an HTTP client to execute a PHP file in my server and this is the code:
try
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://yasinahmed.cpa10.com/sendnoti.php");
HttpResponse response = httpclient.execute(httppost);
Toast.makeText(GCMMainActivity.this, "Done", Toast.LENGTH_LONG).show();
}
catch(Exception e)
{
Toast.makeText(GCMMainActivity.this, "error", Toast.LENGTH_LONG).show();
}
Many times I used this code and it's working without a problem, but this time when I execute the code it always go to the exception and prints the error. This time, I used AVD with Google API level 17, so is this the problem or is there another problem in the code?