标签:android io os ar java for sp on 问题
============问题描述============
package com.test.sztestagain.adapter; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.test.sztestagain.imageUitl.AsyncImageLoader; import com.test.sztestagain.imageUitl.CallBackImpl; import android.content.Context; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; public class MyListAdapter extends BaseAdapter { private LayoutInflater layoutInflater; private List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); private int resource; private AsyncImageLoader loader = new AsyncImageLoader(); private String[] text; private int[] id; private String image; private int imageId; public MyListAdapter(Context context, List<Map<String, Object>> list, int resource, String[] text, int[] id, String image, int imageId) { this.list = list; this.resource = resource; this.text = text; this.id = id; this.image = image; this.imageId = imageId; layoutInflater = LayoutInflater.from(context); } public MyListAdapter(Context context, List<Map<String, Object>> list, int resource, String[] text, int[] id) { this.list = list; this.resource = resource; this.text = text; this.id = id; layoutInflater = LayoutInflater.from(context); } @Override public int getCount() { return this.list != null ? this.list.size() : 0; } @Override public Object getItem(int position) { return this.list.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { // if (convertView == null) { convertView = layoutInflater.inflate(resource, parent, false); // } if (image != null && !"".equals(image)) { ImageView imageView = (ImageView) convertView.findViewById(imageId); CallBackImpl callBackImpl = new CallBackImpl(imageView); Drawable cacheImage = loader.loadDrawable( list.get(position).get(image).toString(), callBackImpl); if (cacheImage != null) { imageView.setImageDrawable(cacheImage); } } for (int i = 0; i < id.length; i++) { TextView tv = (TextView) convertView.findViewById(id[i]); tv.setText(list.get(position).get(text[i]).toString()); } return convertView; } }
============解决方案1============
标签:android io os ar java for sp on 问题
原文地址:http://www.cnblogs.com/meizhenfen42/p/4030470.html