我正在从hashmap的arraylist显示列表。我创建了自己的适配器来显示列表。但我无法在列表中显示它。我甚至无法在该适配器内进行调试。我的代码是这样的。ListAdapter不充气
public class ListAdapter extends BaseAdapter {
Context _context;
ArrayList<HashMap<String, String>> lists = new ArrayList<HashMap<String, String>>();
public LayoutInflater myInflater;
public ListAdapter(Context context,ArrayList<HashMap<String, String>> list){
this._context = context;
this.lists = list;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
this.myInflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView==null)
{
convertView = myInflater.inflate(R.layout.list_items, parent, false);
TextView TT = (TextView) convertView.findViewById(R.id.system_text);
System.out.println("systemName name is"+this.lists.get(position).get("SystemName"));
TT.setText(this.lists.get(position).get("SystemName"));
}
return convertView;
}
}
谢谢。
您getView小鬼说法也是错误的。移动这个'TT.setText(this.lists.get(position).get(“SystemName”));'out of if – Raghunandan