bytearray - Android get image from url SingleClientConnManager problem -


i using following code images of logo , save in database.

defaulthttpclient mhttpclient = new defaulthttpclient(); httpget mhttpget; httpresponse mhttpresponse; httpentity entity;   (int reportscount = 0; reportscount < reportsarr.length; reportscount++) {      //make request our image   mhttpget = new httpget(reportsarr[reportscount][1]);   byte[] categorylogoarr = null;    try {     mhttpresponse = mhttpclient.execute(mhttpget);      if (mhttpresponse.getstatusline().getstatuscode() == httpstatus.sc_ok) {          entity = mhttpresponse.getentity();         logoarr= entityutils.tobytearray(entity);      }    } catch (clientprotocolexception e) {     // todo auto-generated catch block     e.printstacktrace();    } catch (ioexception e) {    // todo auto-generated catch block     e.printstacktrace();    }     long categoryid = datahelper.addcategory(reportsarr[reportscount][0], categorylogoarr); } 

the first image added perfectly, rest of cases not working , giving following warning.

warn/singleclientconnmanager(2389): invalid use of singleclientconnmanager: connection still allocated. 

what problem in code? change solve it?

you need consume content before can reuse connection. may duplicate of exception using httprequest.execute(): invalid use of singleclientconnmanager: connection still allocated

i think need consume content if response code not httpstatus.sc_ok, , in exception handlers.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -