Here I am trying to POST some data from mobile to the server.For that First I have to login for authentication on the server. then after I am sending the data via POST request I have checked this related stackoverflow question. HttpClient 4.0.1 - how to release connection?
I have tried all these methods one by one.
1.EntityUtils.consume(entity);
2.is.close();
response.getEntity().consumeContent(); //in that consumeContent() shows to be Deprecated
post.abort();
Here is my detailed code in the pastebin links please check this.
Here are the program flow.
First login is called Check HERE MY LOGIN REQUEST
After login and before post idea THIS method is called.
And finally post idea method is called.
but logcat is showing me error :
java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one
W/System.err( 2217): java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated. W/System.err( 2217): Make sure to release the connection before allocating another one. W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.conn.BasicClientConnectionManager.getConnection(BasicClientConnectionManager.java:161) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.conn.BasicClientConnectionManager$1.getConnection(BasicClientConnectionManager.java:138) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:455) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:902) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:801) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:780) W/System.err( 2217): at com.rahul.cheerfoolz.api.util.postData(util.java:436) W/System.err( 2217): at com.rahul.cheerfoolz.postidea.idea.post_myidea_edit$Post_Idea.doInBackground(post_myidea_edit.java:354) W/System.err( 2217): at com.rahul.cheerfoolz.postidea.idea.post_myidea_edit$Post_Idea.doInBackground(post_myidea_edit.java:1) W/System.err( 2217): at android.os.AsyncTask$2.call(AsyncTask.java:185) W/System.err( 2217): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) W/System.err( 2217): at java.util.concurrent.FutureTask.run(FutureTask.java:138) W/System.err( 2217): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) W/System.err( 2217): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) W/System.err( 2217): at java.lang.Thread.run(Thread.java:1019)