I having the "out of memory" error on my ImageAdapter, I tried some solutions reusing the ImageView, but not works, I hope any can help me :)
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) {
imageView = new ImageView(mContext);//Creamos la imagen sólo si no existe
} else {
imageView = (ImageView) convertView;//Sino reusamos el objeto
}
//Todas con el mismo ancho
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new GridView.LayoutParams(70, 70));
imageView.setImageResource(mThumbIds[position]);
return imageView;
}
I have some app similar, but not this problem, for sure on this I have 290 diferent images, and the other app I have only one :), I thought that the convertView == null fix the outOfMemory problems
More info: - Only 20 images have more of 100kb, only 3 of these are >500k and <900k
PD: Im using this tutorial code: http://www.androidhive.info/2012/02/android-gridview-layout-tutorial/
Thanks for your help guys and sorry my english