How to use a button from a fragment in a expandableListAdapter

65 views Asked by At

I have a issue with my android app : I have a fragment which has a expandableListAdapter and a button to save.

My question is when I edit some information in one of the list of the expandableListAdapter how can I use the button save.

Because when I use it on the fragment itself I don't have the data edited on the expandableListAdapter and it seems that I can't use it in the expandableListAdapter itself.

Can you help me with this issue.

Thanks a lot for your time

1

There are 1 answers

2
Paul Reznik On BEST ANSWER

As far as I understand your question, you want to call a method in you expandableListAdapter(to save the data), after the save button was tapped.

If it is so, than:

  1. create a object variable of you ExpandableListAdapter in the corresponding Fragment and assing it.
  2. create a method in ExpandableListAdapter, which should be called to save the data
  3. in onClickListener() of the button, call the method on the ExpandableListAdapter object, which you have created in step 2.