android - java.lang.OutOfMemoryError: bitmap size exceeds VM budget? -


Friends,

I am using the following code to display a bitmap on the screen and the next And the previous button

New Code

  HttpGet httpRequest = null;  

{HttpRequest = new HttpGet (mImage_URL [Val]); } Hold (exception e) {return 0; } Http client httpclient = new DefaultHttpClient (); HttpResponse response = (HTTPPS) httpclient.execute (httpRequest); Bitmap bm; HttpEntity unit = response.getEntity (); Buffer httptextf buff html entrant = new buffed htpnt (unit); InputStream = bufHttpEntity.getContent (); Try {BM = BitMap Feature Encodestream (is); } Hold (exception before) {} is.close ();

Old code

  URL aURL = new URL (mImage_URL [VAL]); URLConnection conn = aURL.openConnection (); Conn.connect (); InputStream = Faucet; Try {is = conn.getInputStream (); } Grip (IOE EXPRESS E) {} BuffhendInputStream BIS = New BufferInputStream (); BM = Bitmapfinder Ecodestream (bis); Bis.close (); is close(); Img.setImageBitmap (BM);  

And it was giving me error decoder-> decode return false.

On images larger than 400kb.

So after the googling I got the new code as the answer, the old code was not giving me the memory error on those pictures, but the decoder-> the decoded return is false, so I chose the new code.

Nobody guides me that I am the solution and what is the best way to display images?

Another option in the zestedcodebown can help you find the right sample value


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -