我正在從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