In my Android app it says: org.apache.http.client.httpclient is deprecated. After some research I found out that Android has deprecated it in API 22. I have searched in the forum and tried: "The application has stopped", Searched google: "The application has stopped". So I have no idea what to do. I hope you guys can help me out. Well here is my code:
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.URL.com");
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
Log.e("log_tag", "connection success");
// Toast.makeText(getApplicationContext(), "pass", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e("log_tag", "Error in http connection" + e.toString());
Toast.makeText(getApplicationContext(), "Connection fail", Toast.LENGTH_LONG).show();
EDIT:
I'm trying to get some data of my Mysql database. Do you know a good tutorial about how this is done? Please let me know.
Stop using it and use URLConnection instead. It's been 4 years Google recommends this. http://android-developers.blogspot.be/2011/09/androids-http-clients.html
If you want an external library with a nicer API, you can try OkHttp: http://square.github.io/okhttp/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With