for (int i = 0; i < array.length(); i++) {
String type = array.getJSONObject(i).getString("id");
if (type.contains(".")) {
String mainType = type.substring(0, type.indexOf("."));
String subType = type.substring(type.indexOf(".") + 1);
ListItem mainItem = new ListItem(mainType);
mainItem.setUserData(mainType);
typeSet.add(mainItem);
ListItem subItem = new ListItem(subType.substring(0, 1).toUpperCase() + subType.substring(1));
subItem.setUserData(type);
typeSet.add(subItem);
} else {
ListItem item = new ListItem(type);
item.setUserData(type);
typeSet.add(item);
}
}
List<ListItem> typeList = new ArrayList(typeSet.toArray());
list1Button.setListData(typeList);