ListView 内存溢出 减少内存使用

  这个是常用写的写法,但是会导致将getCount中的数据全部加载到内存中去,导致内存泄露

修改后的写法 :

   if (convertView == null)
            {
                convertView = LayoutInflater.from(mContext).inflate(
                        R.layout.music_list_litem, parent, false);
            }
   listImage = (ImageView) convertView.findViewById(R.id.musicImage);

 

    if (listImage != null)    // 在此处进行判断否则,O(∩_∩)O~,简单吧
            {
               //do something
            }

你可能感兴趣的:(list,ListView,null)