我正在使用两个不同的列表,因为我需要两者的信息。getItem(position) 从 mChampionList 获取项目,因此我可以检索 ID 并从 mChampionListSTATIC 列表中查找冠军。第一次调用 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;
}