这是recyclerview adpater onBindViewHolder方法,每次我进行rquest时,我都会获得10个元素添加到List并通知dapater,这很好但是在4或5次调用后我的应用程序在PICASO获取图像时崩溃,并导致内存不足例外
public void onBindViewHolder(ViewHolder holder, int position) {
try {
//okhttp client
OkHttpClient client = new OkHttpClient();
//okhttp downloader
OkHttp3Downloader downloader = new OkHttp3Downloader(client);
//picaso fetch the image set to image view , width 500 ,height 100
picasso = new Picasso.Builder(context).downloader(downloader).build();
picasso.load(recordList.get(position).getImageUri())
.error(R.drawable.golootlo_placeholder_nearby)
.placeholder(R.drawable.golootlo_placeholder_nearby)
.fit()
.into(holder.imageViewBanner);
}catch (Exception e){
System.out.print(e.getMessage());
}
/*rest of view are getting value here from List object*/
}