Direct Sticker Code
public class Httpclientimagedownloader extends Baseimagedownloader implementsimagedownloader {public Httpclientimagedownloader (Context context) {super (context);} @Overrideprotected inputstream getstreamfromfile (string Imageuri, Object extra) throws IOException {string FilePath = Scheme.FILE.crop (Imageuri); File File = new file (FilePath), if (!file.exists ()) File.createnewfile (), return new Contentlengthinputstream (new Bufferedinputstream (New FileInputStream (FilePath), buffer_size), (int) new File (FilePath). Length ()); @SuppressLint ("usevalueof") @Overrideprotected inputstream getstreamfromnetwork (String Imageuri, Object extra) throws IOException {//httpurlconnection conn = createconnection (Imageuri, extra);////int Redirectcount = 0;//while ( Conn.getresponsecode ()/+ = 3 && Redirectcount < Max_redirect_count) {//conn = CreateConnection (conn.gethe Aderfield ("location"), extra);//redirectcount++;//}<span style= "font-family:arial, Helvetica, Sans-serif;" >//eofexception from Conn.getrEsponsecode () </span>//inputstream imagestream;//try {//imagestream = Conn.getinputstream ();/} catch ( IOException e) {////Read all data to allow reuse connection (Http://bit.ly/1ad35PY)//ioutils.readandclosestream ( Conn.geterrorstream ());//throw e;//}defaulthttpclient client = new Defaulthttpclient (); HttpGet request = new HttpGet (Imageuri); Request.getparams (). Setparameter ("Http.socket.timeout", New Integer ( ConnectTimeout) Request.addheader ("Pragma", "No-cache"), Request.addheader ("Cache-control", "No-cache"); Request.addheader ("Charset", "UTF-8"); HttpResponse HttpResponse = client.execute (request); httpentity entity = httpresponse.getentity (); InputStream ImageStream = Entity.getcontent (); return new Contentlengthinputstream (New Bufferedinputstream (ImageStream, buffer_size), (int) entity.getcontentlength ());}}Additionally configured for own Imageloader
imageloaderconfiguration config = new Imageloaderconfiguration.builder (Getapplicationcontext ()). Defaultdisplayimageoptions (defaultoptions). ThreadPriority (thread.norm_priority-2). Denycacheimagemultiplesizesinmemory (). ThreadPoolSize (3). Imagedownloader (New Httpclientimagedownloader (this)). Tasksprocessingorder (Queueprocessingtype.lifo). MemoryCache (New Weakmemorycache ()). build ();
Use the Eofexception workaround that appears in Universal-image-loader