0

How to get value in an array list from Textview and radio button in RecyclerView on click button

when clicking on button then store in an array list please help me

enter image description here

Shahbaz Hashmi
  • 2,631
  • 2
  • 26
  • 49
Karan Chunara
  • 518
  • 4
  • 15

2 Answers2

1

Question is not clear. From where you want to store a data as an array ? From checkbox and where is your text - is it question of your text or what ? Pal, if you want to collect data from check box then you can use onCheckChangeListener. On this .

final List<String> mList = new ArrayList<>();
 mList.add("Your value");
Lazy Mind
  • 143
  • 9
0

I guess your button is in Fragment (or Activity) and your radio button is in an item of RecyclerView.

You can do like

If your RecyclerView is recyclable

  • User select the radio button
  • You will receive the selected item by setOnCheckedChangeListener
  • You save this value to a field in Adapter (you can save to a list, map, or any other datatype you like)
  • When you click at Button, you can get this value like adapter.

If your RecyclerView is not recyclable

You don't need to save any value.

When click at Button, you can get RecyclerView item -> then get RadioGroup -> get selected RadioButton.

Linh
  • 57,942
  • 23
  • 262
  • 279