How do you update a Glass CardScrollView programatically in XE16 (KitKat)?
I have a CardScrollView of cards that display photos from url's. I download the photos from the url's in a background thread and then I want to "refresh" or update the CardScrolView to make the cards display the new images.
I was calling:
cardScrollView.updateViews(true);
In XE12, but in XE16/KitKat that operation is deprecated. So how do you download an image in the background and then update a displayed "Card" with that image? Just calling card.addImage() seems to add a blank image and doesn't display the image.
I've updated my call from the background thread to be:
cardScrollView.getAdapter().notifyDataSetChanged();
Here is the code for 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 that calling cardScrollView.getAdapter().notifyDataSetChanged(); would cause Cards already put into the scrollview to update the image they have stored?