Thursday, July 29, 2010

[android-developers] Load lots of Image from Internet and get Out-Of-Memory

public Bitmap DecodeFile(String Url)
{
try {
URL aURL = new URL(Url);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
return bm;
}
catch (Exception e)
{
return null;
}
}

I am using the above code to decode the bitmap , and save it inito the
imageview
but i get out-of-memory error when loading a lots of image
is there any better way to do that such that the image will not be
resized?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate