CardListView 在迭代 sqlite 行后在其所有 CardViews 中获得相同的图像

CardListView gets the same image in all its CardViews after iterating sqlite rows

我正在使用 cardslib library in my Android Studio project. I'm working on a CardListView. I'm retrieving each CardView information from an sqlite database row which has a BLOB field (used to store images). As shown in this picture,从数据库中填充 CardListView 后,除了 CardThumbnail 之外,一切似乎都很好。它只显示列表的每个 CardView 中的最后一个迭代数据库行位图字段。

我正在使用此代码迭代每个 sqlite 行并填充 CardListView 项目:

    /* Retrieving items from database */
    List<Item> items = dataBase.getAllItemsLOC();
    int itemsLOCCount = items.size();

    /* Iterating retrieved database items */
    for (int i = 0; i < itemsLOCCount; i++) {
        final Item item = items.get(i);

        RentCard card = new RentCard(getActivity());

        /* Add thumbnail */
        CardThumbnail cardThumbnail = new CardThumbnail(getActivity());
        cardThumbnail.setCustomSource(new CardThumbnail.CustomSource() {
            @Override
            public String getTag() {
                return "com.google.android.apps.maps";
            }

            @Override
            public Bitmap getBitmap() {
                Bitmap bitmap = item.getImageBitmap();
                return bitmap;
            }
        });
        card.addCardThumbnail(cardThumbnail);

        card.setDevise(item.getDevise());

        /* ... setting the rest of the CardView properties ... */

        card.setId("" + items.get(i).getId());

        cards.add(card);
    }
    mCardArrayAdapter.notifyDataSetChanged();

你能帮我找出问题吗?

感谢 Rami,我通过替换这部分代码解决了我的问题:

@Override
public String getTag() {
    return "com.google.android.apps.maps";
}

通过这个:

@Override
public String getTag() {
    return item.getId();
}

现在,我的 CardListView 正确显示每个 sqlite 行中的每个 CardThumbnail 图像,如 this picture 所示。