ウェブサイトから画像をダウンロードしてリストビューに添付しています。
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);
}
1枚だけダウンロードしても問題ありませんが、5枚以上ダウンロードしてリストビューに読み込むと問題が発生します。
問題は
bitmap size exceeds VM budget
この問題を回避する方法は?
注:これは質問と重複していません!
ありがとう。