So I've got a mobile app that loads several objects from the file system, then sorts them by ID, then adds them as categories to an ExpandableListView. However, although the items remain sorted correctly in the Object[] array, the ExpandableListView changes the order seemingly randomly.
In this screenshot, the events should be ordered as follows:
An event Event ID:4
Event 4 Event ID:3
Event 3 Event ID:2
Event 2 Event ID:1
Event 1 Event ID:0
The array is sorted correctly, but when added to the ExpandableListView, the order is randomized.
Here is the code for my EventsListViewAdapter:
public class EventsAdapter extends BaseExpandableListAdapter {
private Context context;
private HashMap<String, List<String>> Events_Category;
private List<String> Events_List;
public EventsAdapter(Context context, HashMap<String, List<String>> Movies_Category, List<String> Movies_List) {
this.context = context;
this.Events_Category = Movies_Category;
this.Events_List = Movies_List;
}
#Override
public int getGroupCount() {
return Events_List.size();
}
#Override
public int getChildrenCount(int groupPosition) {
return Events_Category.get(Events_List.get(groupPosition)).size();
}
#Override
public Object getGroup(int groupPosition) {
return Events_List.get(groupPosition);
}
#Override
public Object getChild(int parentPosition, int childPosition) {
return Events_Category.get(Events_List.get(parentPosition)).get(childPosition);
}
#Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
#Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
#Override
public boolean hasStableIds() {
return false;
}
#Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
String group_title = (String) getGroup(groupPosition);
if(convertView == null) {
LayoutInflater inflator = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflator.inflate(com.cpjd.roblu.R.layout.parent_layout, parent, false);
}
TextView parent_textview = (TextView) convertView.findViewById(com.cpjd.roblu.R.id.parent_txt);
parent_textview.setTypeface(null, Typeface.BOLD);
if(Text.getAPI() > 21) {
parent_textview.setTextColor(Color.parseColor("#FFFFFF"));
} else {
parent_textview.setTextColor(Color.parseColor("#2C3539"));
}
parent_textview.setText(group_title);
return convertView;
}
#Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parentView) {
String child_title = (String)getChild(groupPosition, childPosition);
if(convertView == null) {
LayoutInflater inflator = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflator.inflate(com.cpjd.roblu.R.layout.child_layout, parentView, false);
}
TextView child_textview = (TextView) convertView.findViewById(com.cpjd.roblu.R.id.child_txt);
child_textview.setText(child_title);
return convertView;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
Related
I have Expandable list view in my activity but problem is when I am clicking child element it is not sowing toast message.Below is my MainActivity class and adapter class:
MainActivity.class
public class MainActivity extends AppCompatActivity {
ExpandableListView expand;
List<String> category = new ArrayList<>();
Map<String,List<String>> child = new HashMap<>();
MyExListAdapter adapter;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
expand = findViewById(R.id.expand);
List<String> mobiles = new ArrayList<>();
List<String> jewel = new ArrayList<>();
category.add("Mobile Covers");
category.add("T-Shirts");
category.add("Notebooks");
category.add("Jewellery");
category.add("Honey");
category.add("Corporate Gifts");
category.add("Packaging");
category.add("Deals");
mobiles.add("Apple");
mobiles.add("Samsung");
mobiles.add("OnePlus");
mobiles.add("Vivo");
mobiles.add("Oppo");
mobiles.add("Redmi");
jewel.add("Designer");
jewel.add("Classic");
child.put(category.get(0),mobiles);
child.put(category.get(1),jewel);
adapter = new MyExListAdapter(this,category,child);
expand.setAdapter(adapter);
expand.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
#Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Toast.makeText(getApplicationContext(),"" +child.get(category.get(groupPosition)).get(childPosition),Toast.LENGTH_SHORT).show();
return false;
}
});
}
MyExListAdapter.java
package com.app.aamkuapp.Adapters;
public class MyExListAdapter extends BaseExpandableListAdapter {
Context context;
List<String> category;
Map<String ,List<String>> child;
public MyExListAdapter(Context context, List<String> category, Map<String, List<String>> child) {
this.context = context;
this.category = category;
this.child = child;
}
#Override
public int getGroupCount() {
return category.size();
}
#Override
public int getChildrenCount(int groupPosition) {
return child.get(category.get(groupPosition)).size();
}
#Override
public Object getGroup(int groupPosition) {
return category.get(groupPosition);
}
#Override
public Object getChild(int groupPosition, int childPosition) {
return child.get(category.get(groupPosition)).get(childPosition);
}
#Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
#Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
#Override
public boolean hasStableIds() {
return false;
}
#Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
String cat = (String) getGroup(groupPosition);
if(convertView == null){
LayoutInflater inflater = (LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_parent,null);
}
TextView txt1 = convertView.findViewById(R.id.textParent);
txt1.setText(cat);
return convertView;
}
#Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
String chi = (String) getChild(groupPosition,childPosition);
if(convertView == null){
LayoutInflater inflater = (LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_child,null);
}
TextView txt2 = convertView.findViewById(R.id.textChild);
txt2.setText(chi);
return convertView;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
}
Someone please let me know why Toast is not showing on clicking child element.Any help would be appreciated.
THANKS
Change your adapter code from this..
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
to this..
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
Hope this helps.
I have an expandable list view. In the child item of that is a gridview. Inside gridview there are custom checkboxes.
Now the problem is when I check a checkbox and scroll down, or even close the parent view, the check is gone.
Something like this:
Screen checked before scroll:
Screen checked after scroll:
Here is my ExpandableListView Adapter:
public class CreateProfileExpandableAdapter extends BaseExpandableListAdapter {
ArrayList<CreateProfileFecetsHeaderModel> al;
Activity activity;
public CreateProfileExpandableAdapter(Activity activity, ArrayList<CreateProfileFecetsHeaderModel> al) {
this.activity = activity;
this.al = al;
}
#Override
public Object getChild(int groupPosition, int childPosition) {
return al.get(groupPosition).getChildren();
}
#Override
public long getChildId(int groupPosition, int childPosition) {
return al.get(groupPosition).hashCode();
}
#Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) activity.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.create_profile_child, parent, false);
}
ExpandableHeightGridView gridViewChildren = (ExpandableHeightGridView) v.findViewById(R.id.gridViewChildren);
gridViewChildren.setExpanded(true);
CreateProfileChildAdapter createProfileChildAdapter = new CreateProfileChildAdapter(activity, al.get(groupPosition).getChildren());
gridViewChildren.setAdapter(createProfileChildAdapter);
return v;
}
#Override
public int getChildrenCount(int groupPosition) {
return 1;
}
#Override
public Object getGroup(int groupPosition) {
return al.get(groupPosition);
}
#Override
public int getGroupCount() {
return al.size();
}
#Override
public long getGroupId(int groupPosition) {
return al.get(groupPosition).hashCode();
}
#Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) activity.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.create_profile_group, parent, false);
}
TextView textViewGroup = (TextView) v.findViewById(R.id.textViewGroup);
textViewGroup.setText(al.get(groupPosition).getText());
return v;
}
#Override
public boolean hasStableIds() {
return false;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
Gridview Adapter:
public class CreateProfileChildAdapter extends BaseAdapter {
Activity activity;
ArrayList<CreateProfileFecetsChildModel> al;
int index = -1;
public CreateProfileChildAdapter(Activity activity, ArrayList<CreateProfileFecetsChildModel> al) {
// TODO Auto-generated constructor stub
this.activity = activity;
this.al = al;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return al.size();
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return al.get(position);
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
private static class ViewHolder {
CheckBox checkBoxChild;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final ViewHolder viewHolder;
final int pos = position;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(activity);
convertView = inflater.inflate(R.layout.create_profile_grid_child, parent, false);
viewHolder = new ViewHolder();
viewHolder.checkBoxChild = (CheckBox) convertView.findViewById(R.id.checkBoxChild);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.checkBoxChild.setText(al.get(position).getTitle());
viewHolder.checkBoxChild.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
#Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b) {
viewHolder.checkBoxChild.setTextColor(activity.getResources().getColor(R.color.white));
} else {
viewHolder.checkBoxChild.setTextColor(activity.getResources().getColor(R.color.black));
}
}
});
return convertView;
}
}
The problem is that the Views get recycled without having their state reset. Imagine displaying 20 items on a screen which only shows four items at once, meaning that the GridViewAdapter uses four, maybe five views. Those views take turns displaying your item when scrolling trough the list:
Solution:
You have to store everything about your view's state (in your case: what is marked as checked) in your Adapter's child list entries of the type CreateProfileFecetsHeaderModel.
In your Adapter's getChildView() fetch the checked state from your Adapter's children using the position and set the holder's CheckBox accordingly.
As it is Expandable adapter, u need to know the groupid,selectedchild,id.
try as below...
#Override
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final Pair<Long, Long> tag = new Pair<Long, Long>(
getGroupId(groupPosition),
getChildId(groupPosition, childPosition));
ViewHolder viewHolder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_countryoforigin, null);
viewHolder = new ViewHolder(convertView);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.checkBox.setTag(tag);
viewHolder.checkBox.setChecked(mCheckedItems.contains(tag));
viewHolder.textview.setText((CharSequence) getText(groupPosition, childPosition));
viewHolder.checkBox.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
final CheckBox cb = (CheckBox) v;
final Pair<Long, Long> tag = (Pair<Long, Long>) v.getTag();
if (cb.isChecked()) {
mCheckedItems.add(tag);
} else {
mCheckedItems.remove(tag);
}
}
});
return convertView;
}
public Set<Pair<Long, Long>> getCheckedItems() {
return mCheckedItems;
}
u can call getcheckitems .....
This is my expandlable list adapter call
TableOfContentsAdapter adapter = new TableOfContentsAdapter(TableOfContentsActivity.this,toCList);
mExpandableListViewTOC.setAdapter(adapter);
And this is my adapter implementation
class TableOfContentsAdapter extends BaseExpandableListAdapter {
private Context context;
private List<TOCLink> tocLinks;
public TableOfContentsAdapter(Context context, List<TOCLink> tocLinks) {
this.context = context;
this.tocLinks = tocLinks;
}
#Override
public int getChildrenCount(int groupPosition) {
return tocLinks.get(groupPosition).getTocLinks().size();
}
#Override
public Object getGroup(int groupPosition) {
return tocLinks.get(groupPosition);
}
#Override
public int getGroupCount() {
return tocLinks.size();
}
#Override
public long getGroupId(int groupPosition) {
return (long) (groupPosition * 1024);
}
#Override
public Object getChild(int groupPosition, int childPosition) {
List<TOCLink> childTocLinks = tocLinks.get(groupPosition).getTocLinks();
return childTocLinks.get(childPosition);
}
#Override
public long getChildId(int groupPosition, int childPosition) {
return (long) (groupPosition * 1024 + childPosition);
}
#Override
public boolean hasStableIds() {
return false;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
#Override
public View getGroupView(int groupPosition, boolean b, View convertView, ViewGroup viewGroup) {
TOCLink tocLink = (TOCLink) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_header, null);
}
TextView groupHeader = (TextView) convertView.findViewById(R.id.header);
groupHeader.setText(tocLink.getSectionTitle());
return convertView;
}
#Override
public View getChildView(int groupPosition, int childPosition, boolean b, View convertView, ViewGroup viewGroup) {
TOCLink tocLink = (TOCLink) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_item, null);
}
TextView childItem = (TextView) convertView.findViewById(R.id.item);
childItem.setText(tocLink.getSectionTitle());
/*TOCLink tocLink1 = tocLinks.get(groupPosition).getTocLinks().get(childPosition);
if (tocLink1.getTocLinks().size() > 0) {
new TableOfContentsAdapter(context, tocLink1.getTocLinks());
}*/
return convertView;
}
}
I want to implement multilevel expandable list view with single adapter. Problem here is i'm able to go to level 1 but not further.
How can resolve this problem?
try to implement in your project: https://github.com/defacto133/MultiLevelExpandableIndentableListView
I have an ExpandableListView which is populated using data coming from serverside(reftrofit) how can I use an Adapter to get a specific element of the object? The expandable list view contains parent and child elements. When I click on the child element I would like to extract an ID(SensorID) that is associated with that child element.
I Have an Adapterwhere I am attempting to extract the ID from the object but I am unable to. I noticed that for an array Adapterthe getItemAtPosition() method is used to get an index then extract an element from the object(sensorID).
I am however not sure if this is the same method that should be used for an ExpandableListAdapter because I have seen snippets of code where the method getChild() is used.
The error I get everytime on click reads
ExpandableListConnector cannot be cast to
com.xera.deviceinsight.home.ExpandableListAdapter
The method in question
private void load(View view)
{
expListView = (ExpandableListView) view.findViewById(R.id.lvExp);
prepareListData();
listAdapter = new ExpandableListAdapter(this.getActivity(), listDataHeader, listDataChild);
expListView.setAdapter(listAdapter);
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
#Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
System.err.println("child clicked");
Toast.makeText(getActivity(), "child clicked", Toast.LENGTH_SHORT).show();
EventBus.getDefault().post(new ItemClickedEvent(SensorInformationChildFragment.TAB_CALL));
ExpandableListAdapter adapter = (ExpandableListAdapter)parent.getAdapter();
OrganisationDeviceSensorsResult deviceSensor = (OrganisationDeviceSensorsResult) adapter.getChild(groupPosition , childPosition);
sensorID = deviceSensor.SensorID;
ReportingGroup.get(childPosition);
return true;
}
});
}
Adapter:
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<String> _listDataHeader; // header titles
// child data in format of header title, child title
private HashMap<String, List<String>> _listDataChild;
public List<OrganisationDeviceSensorsResult> Items;
public ExpandableListAdapter(Context context, List<String> listDataHeader,
HashMap<String, List<String>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
#Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
#Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
public OrganisationDeviceSensorsResult getItemAtPosition(int index)
{
return getItemAtPosition(index);
//return this.getItem(index);
//return this.getItem(index);
//return index;
//return this.get
//return OrganisationDeviceSensorsResult.
}
#Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String childText = (String) getChild(groupPosition, childPosition);
OrganisationDeviceSensorsResult deviceSensor = getItemAtPosition(childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_item, null);
}
TextView txtListChild = (TextView) convertView
.findViewById(R.id.lblListItem);
txtListChild.setText(childText);
return convertView;
}
#Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.size();
}
#Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
#Override
public int getGroupCount() {
return this._listDataHeader.size();
}
#Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
#Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
}
TextView lblListHeader = (TextView) convertView
.findViewById(R.id.lblListHeader);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
return convertView;
}
#Override
public boolean hasStableIds() {
return false;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
I had more or less your situation, I do it with this code in the Activity where the listview is placed:
contactListExpandable = (ExpandableListView) findViewById(R.id.contactlist);
contactListAdapter = new ContactListAdapter(this, chatGroupList);
contactListExpandable.setAdapter(contactListAdapter);
contactListExpandable.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
#Override
public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) {
ChatContact contact = chatGroupList.get(groupPosition).getContacts().get(childPosition);
launchChat(contact, null, false, "");
return false;
}
});
In my case, I get the child Object to launch a chat, etc, in your case you will be abre to obtain the Sensor object and do your stuff
=== ChatGroup ===
public class ChatGroup implements Comparable{
final public String name;
private List<ChatContact> contacts;
public ChatGroup(String name){
this.name = name;
this.contacts = new ArrayList<>();
}
public void addContact(ChatContact contact){
this.contacts.add(contact);
}
public List<ChatContact> getContacts(){
return this.contacts;
}
#Override
public int compareTo(Object o) {
ChatGroup cg = (ChatGroup)o;
return name.compareTo(cg.name);
}
}
=== ChatContact.java ===
public class ChatContact implements Parcelable, Comparable {
final public String name;
final public String jid;
public Status status;
public ChatContact(String name, String jid) {
this.name = name;
this.jid = jid;
}
.....getters/setters/etc.....
}
After reading data from a CSV file, I have it stored in List.
List <String>listDataHeader = new ArrayList<String>();
Map<String,String>listDataChild = new HashMap<String, String>();
List<String[]> termDefinition = csv.read();
Then I itirate over the list and want to store the data. As it is written now, I take the correct keys, but not the values:
for (String[] term : termDefinition) {
listDataHeader.add(term[0]);
listDataChild.put(term[0], term[1]);
}
May you help me? Thanks!
EDIT:
I need to fill data in ExpandavbleListVew. The listdataHeader is the main topic, the listdataChild is the subitem. There are only 2 columns in the CSV, in the format term-definition. At the moment, main topics (from the listDataheader) are stored correctly. After correcting the loop (see above), I have for each main item the definition appearing as many times as the size of the loop (10 in the case).
Here is the expandableListView class:
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context context;
private List<String> listDataHeader; // header titles
// child data in format of header title, child title
private Map<String, String> listDataChild;
public ExpandableListAdapter(Context context, List<String> listDataHeader,
Map<String, String> listChildData) {
this.context = context;
this.listDataHeader = listDataHeader;
this.listDataChild = listChildData;
}
#Override
public Object getChild(int groupPosition, int childPosititon) {
return this.listDataChild.get(this.listDataHeader.get(groupPosition));
}
#Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
#Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String childText = (String) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this.context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item, null);
}
TextView txtListChild = (TextView) convertView
.findViewById(R.id.itemList);
txtListChild.setText(childText);
return convertView;
}
#Override
public int getChildrenCount(int groupPosition) {
return this.listDataChild.size();
}
#Override
public Object getGroup(int groupPosition) {
return this.listDataHeader.get(groupPosition);
}
#Override
public int getGroupCount() {
return this.listDataHeader.size();
}
#Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
#Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this.context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.header, null);
}
TextView lblListHeader = (TextView) convertView
.findViewById(R.id.headerList);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
return convertView;
}
#Override
public boolean hasStableIds() {
return false;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
I don't see the point of the listDataHeader List. Using it causes you to put the same key (listDataHeader.get(0)) over and over again in the Map.
Since you only have 2 columns in each row of the CSV, all you need is :
for (String[] term : termDefinition) {
listDataChild.put(term[0], term[1]);
}