I am downloading the image from website and attach into listview.
URL aURL;
try {
aURL = new URL(//"http://www.orientaldaily.com.my/"+
imagepath[i]);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
imageview = (ImageView) findViewById(R.id.image_alllatestnewstitle);
imageview.setVisibility(View.VISIBLE);
imageview.setScaleType(ScaleType.CENTER_CROP);
imageview.setImageBitmap(bm);
} catch (IOException e) {
Log.e("DEBUGTAG", "Remote Image Exception", e);
}
When i downloading only 1 image, it got no problem, however when i downloading multiple or more than 5 images and load into listview, it cause problem.
The problem was
bitmap size exceeds VM budget
How to avoid this problem?
Note: this is not duplicate any question!
Thanks.