title: Recyclerview add radiobutons programmatically
body: <p>I am creating an Android app with Java which displays a question and 3 or 4 options for it (MCQ app). I have used a RecyclerView with a TextView in the XML to hold the question. </p>
  
  <p>However, I am confused on how to create the radio button/checkbox for the option part since those are dynamic. Meaning, a question might have any number of options as radio button from 1 to 6 depending on the entries in the database. Also, few of the question might have checkbox rather than radio button again depending on the DB entries. </p>
  
  <p>Since these are decided at runtime, there is no way I can keep these radiobuttons/checkboxes in the XML file. Initially I tried creating them inside onBindViewHolder method but doing that significantly slows down the scrolling since this method gets called even while scrolling. Since this is a very common use case, I would like to believe the framework must have readily available solution for this which I am yet to discover. </p>
  
  <p>I do not want to add all the possible radiobuttons/checkboxes and play with the visibility of those in runtime.</p>