Search code examples
androideclipselistenergoogle-now

CardsUI for Android setScrollListener


I am attempting to use Navadfima's CardsUI for Android here. The problem is I have approximately 1500 bitmaps (each one goes on a card) and even when using the scaling suggestions at the DevDocs I run out of memory. My current plan is to set an onScrollListener in the CardUI activity but I don't know how to make one in a library that I can call from my code.

CardUI class from Library is here

My class:

public class FragmentCardsUI extends Fragment{
private CardUI mCardView;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View rootView = inflater.inflate(R.layout.activity_card, container, false);
    getActivity().setTitle("Cards UI");

    // init CardView
    mCardView = (CardUI) rootView.findViewById(R.id.cardsview);

    try {
        setCards();
    } catch (NullPointerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    mCardView.refresh();
return rootView;

How can I modify CardUI so I can set an onScrollListener in my code so I can tell when a card is visible and subsequently load a bitmap to it?


Solution

  • Never found a good solution for this so I switched libraries to use Nostra's Universal Image Loader. This library appears to still be in development as opposed to the CardsUI library (hasn't had a change in over 7 months but there are plenty of requests).