@Override public View getView(int position, View convertView, ViewGroup arg2) { // TODO Auto-generated method stub ListItemView listItemView = null; if (convertView == null) { listItemView = new ListItemView(); convertView = inflater.inflate(R.layout.griditem, null); listItemView.image = (ImageView) convertView.findViewById(R.id.griditem_image); listItemView.folder_name = (TextView) convertView.findViewById(R.id.griditem_folder); listItemView.creat_time = (TextView) convertView.findViewById(R.id.griditem_time); // listItemView.rl = ( RelativeLayout)convertView.findViewById(R.id.griditem_relative); // listItemView.rl2 = (RelativeLayout)convertView.findViewById(R.id.griditem_relative2); listItemView.page_num = (TextView) convertView.findViewById(R.id.griditem_num); convertView.setTag(listItemView); } else { listItemView = (ListItemView) convertView.getTag(); } if (mlist2.get(position) != null) { Photo_info minfo = mlist2.get(position); String image_Path = root_Path + minfo.getName() + "/" + minfo.getImage_name(); int num = minfo.getImage_num(); if (minfo.isCheck()) { listItemView.image.setBackgroundResource(R.drawable.paper_shadow4); } else { if (num == 1) { listItemView.image.setBackgroundResource(R.drawable.paper1_shadow); } else if (num == 2) { listItemView.image.setBackgroundResource(R.drawable.paper2_shadow); } else { listItemView.image.setBackgroundResource(R.drawable.paper_shadow); } } String name = minfo.getName(); if (Activity_Main.getBitmapFromMemCache(name) != null) { loadBitmap2(listItemView.image, name); } else { loadBitmap(image_Path, listItemView.image, name); } if (num == 1) { listItemView.page_num.setText(num + " page"); } else { listItemView.page_num.setText(num + " pages"); } listItemView.folder_name.setText(name); listItemView.creat_time.setText(minfo.getTime()); } return convertView; }
public void loadBitmap2(ImageView imageView, String name) { Bitmap bitmap = Activity_Main.getBitmapFromMemCache(name); imageView.setImageBitmap(bitmap); }