How do you update Glass CardScrollView programmatically in XE16 (KitKat)?

How do you update Glass CardScrollView programmatically in XE16 (KitKat)?

I have CardScrollView cards that display photos from url. I upload photos with url in the background stream, and then I want to “update” or update CardScrolView so that the cards display new images.

I called:

cardScrollView.updateViews (true);

In XE12, but in XE16 / KitKat this operation is deprecated. So, how do you download an image in the background and then update the displayed "Map" with that image? Just calling card.addImage () seems to add a blank image and not display the image.

I updated my call from the background thread:

cardScrollView.getAdapter (). notifyDataSetChanged ();

Here is the code of the card scroll adapter with

private class SpecialCardsScrollAdapter extends CardScrollAdapter {

    @Override
    public int getPosition (Object item) {
        return specialCardsList.indexOf (item);
    }

    @Override
    public int getCount () {
        return specialCardsList.size ();
    }

    @Override
    public Object getItem (int position) {
        return specialCardsList.get (position);
    }

    @Override
    public View getView (int position, View convertView, ViewGroup parent) {
        return specialCardsList.get (position) .getView ();
    }

}

Should I expect a call to cardScrollView.getAdapter (). notifyDataSetChanged (); will cause the cards to already be placed in scrollview to update the image they save?

+4
source share
1 answer
+4

Source: https://habr.com/ru/post/1536854/


All Articles