use of it.gmariotti.cardslib.library.view.CardExpandableListView in project cardslib by gabrielemariotti.
the class ExpandableListCardFragment method initCards.
private void initCards() {
//Init an array of Cards
SparseArray<BaseGroupExpandableCard<String>> cards = new SparseArray<BaseGroupExpandableCard<String>>();
for (int i = 0; i < 50; i++) {
List<String> children = new ArrayList<String>();
for (int j = 0; j < 5; j++) {
children.add("Sub item" + j);
}
BaseGroupExpandableCard card = new BaseGroupExpandableCard(this.getActivity(), children);
card.setTitle("Application example " + i);
cards.append(i, card);
}
CardExpandableListAdapter mCardArrayAdapter = new CardExpandableListAdapter(getActivity(), cards);
CardExpandableListView listView = (CardExpandableListView) getActivity().findViewById(R.id.carddemo_list_expand);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
}
Aggregations