ViewPager
それぞれが異なる画像を含む〜50ページで表示したい。Picasso を使用すると、最初の 20 ~ 25 ページが完全に機能します。ただし、その時点で が表示されOutOfMemoryError
、画像がまったく読み込まれていません。
Throwing OutOfMemoryError "Failed to allocate a 7477932 byte allocation with 1932496 free bytes"
で次のコードを使用していますPagerAdapter
。
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
View view = getView();
Picasso picasso = getImageLoader(mContext);
picasso.load(getUrl(position)).fit().into((ImageView) view.findViewById(R.id.imageview));
container.addView(view);
return view;
}
@Override
public void destroyItem(final ViewGroup container, final int position, final Object object) {
container.removeView((View) object);
}
これを避けるにはどうすればよいですか?