private void initDatas() { groupItems = new ArrayList<BabyJiShiBenListViewExpandableGroupItem>(); groupItem = new BabyJiShiBenListViewExpandableGroupItem(); groupItem.setTitle("今天"); luyinItems = dbService.getTodayItems(DateFormater.getInstatnce().getYMD()); luyinItem = new BabyLuYin(); luyinItem.setImageId(R.drawable.add_icon); luyinItems.add(0, luyinItem); if (luyinItems.size() == 1) { groupItem.setNum(0); } else { groupItem.setNum(luyinItems.size() - 1); } groupItem.setImage(R.drawable.group_unexpand_icon); groupItem.setLuyinItems(luyinItems); groupItems.add(groupItem); groupTitles = dbService.getMonths(DateFormater.getInstatnce().getYM()); if (groupTitles.size() > 0) { for (String groupTitle : groupTitles) { groupItem = new BabyJiShiBenListViewExpandableGroupItem(); groupItem.setTitle(groupTitle); groupItem.setLuyinItems( dbService.findItemsByYM(groupTitle, DateFormater.getInstatnce().getYMD())); if (groupItem.getLuyinItems().size() > 0) { groupItem.setNum(groupItem.getLuyinItems().size()); groupItems.add(groupItem); } groupItem = null; } } }
@Override public void onDestroy() { super.onDestroy(); dbService.closeDB(); }