Problem while using recyclerview with cardview

461 viewsandroid android-studio java recyclerview
Chirag Shah | 12 xp

What I want to do is this:  I have a quiz application containing recyclerview which contains several cardviews.
Each cardview itself holds one question and 4 options to choose. These four options are in form of radiobuttons among which there is one correct answer. There are 16-17 such cardviews containing question and options. Now, after useranswers all these questions., I have a submit button at the end of recyclerview. When user clicks on submit, the score scored by user gets displayed to him.There are two problems,

  1. How to keep track of which radiobutton has been clicked by user in every cardview.
  2. When I click on on radiobutton in a cardview, because of recycle property of recyclerview, the radiobutton get selected randomly on scroll.

I am unable to solve both the problems mentioned above. Also, my questions are in json file which I am loading using Volley Library. Please help me. Below are few screenshots attached of my app:

Kanthikiran_Nalamati | 76 xp

even im facing the second issue..but for the first issue use string builder to store the radio buttons value and pass the variable on submit button..hope it will work…check the below code