I am trying to create a simple android app that will communicate with website. The problem I am having is that every time I try and use the HttpPost Eclipse’s debugger tells me that:
Source not Found
The JAR file C:\Users…\android-sdk\plarforms\android-16\android.jar has no source attachment
You can attach the source by clicking Attach Source below:
I tried to attach a few jar files but nothing has worked. Here is my code:
public void onClick(View v) {
URI website = null;
HttpResponse response = null;
BufferedReader in = null;
HttpClient client = new DefaultHttpClient();
try {
website = new URI("http://fakewebsite.php");
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HttpGet getRequest = new HttpGet();
getRequest.setURI(website);
HttpPost postRequest = new HttpPost();
try {
response = client.execute(postRequest);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Thank you for any help
use
instead of
you are getting this error because you are currently not setting URI for
HttpPost postRequest = new HttpPost();