我使用两个不同的列表,因为我需要两者的信息。 getItem(position)从mChampionList获取项目,这样我就可以从mChampionListSTATIC列表中检索ID并查找冠军。它第一次调用getView()时,填充了mChampionListSTATIC,我可以获得所需的信息。但在那之后,mChampionListSTATIC为空。
@Override
public View getView(int position, View convertView, ViewGroup parent) {
///
//holder stuff happens here, removed it to save space//
///
Champion champion = getItem(position);
Champion_STATIC championSTATIC = mChampionListSTATIC.getChampionById(champion.getId());
holder.icon.setImageResource(mContext.getResources().getIdentifier(championSTATIC.getName().toLowerCase(), "drawable", mContext.getPackageName()));
holder.name.setText(championSTATIC.getName());
return convertView;
}