0

両方からの情報が必要なので、2 つの異なるリストを使用しています。getItem(position) は mChampionList からアイテムを取得するので、ID を取得して mChampionListSTATIC リストからチャンピオンを検索できます。初めて getView() を呼び出すと、mChampionListSTATIC が読み込まれ、必要な情報を取得できます。しかしその後、mChampionListSTATIC は null になります。

@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;
    }
4

0 に答える 0