开发者

Handling Empty List in ExpandableListView in android

I am trying to create multiple categories in an activity which extends Expand开发者_JAVA技巧ableListActivity. Now some of the categories have items and some dont. but when I click on the EmptyList ones I get a Force Close message with null pointers.

I am trying to hide the Arrow Indicator when the list is empty or just not do anything since it doesnt have items.

Can someone please help me with an example if possible.

Regards


We can't have a group with no child in other words group should have the instance of the ExpandListChild, So just follow these steps

ArrayList<ExpandListChild> list2 = new ArrayList<ExpandListChild>();
ExpandListGroup gru5 = new ExpandListGroup();
    gru5.setName("Home");
    gru5.setItems(list2);

There is no need to add any item in the ExpandListChild

Hope this will help you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜