title: Selecting one RadioButton value and scrolling back removing the selected one in RecyclerView
body: <p>In my application am displaying 20 multiple choice questions with the help of <code>RecyclerView</code>.</p>
  
  <p>If I change the value of first <code>RadioGroup</code> and scrolls down, again scrolls up removing the selected value in <code>RecycelarView</code> and also i want to use that selected <code>RadioButton</code> value further, I was also checked <a href="https://stackoverflow.com/q/28972049/2169192">link1</a> but i did't understood what he is doing. </p>
  
  <p>Here is my sample code snippet let me know if you need any clarification.</p>
  
  <pre><code>    package com.testing.survey;
  
  import java.util.List;
  
  import android.annotation.SuppressLint;
  import android.support.v7.widget.RecyclerView;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.RadioButton;
  import android.widget.RadioGroup;
  import android.widget.RadioGroup.OnCheckedChangeListener;
  import android.widget.TextView;
  
  @SuppressWarnings("rawtypes")
  public class DataAdapter extends RecyclerView.Adapter&lt;DataAdapter.ViewHolder&gt; {
  
      private List&lt;Student&gt; stList;
  
      public DataAdapter(List&lt;Student&gt; students) {
          this.stList = students;
      }
  
      // Create new views
      @Override
      public DataAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
              int viewType) {
          // create a new view
          View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(
                  R.layout.list_row, null);
  
          // create ViewHolder
  
          ViewHolder viewHolder = new ViewHolder(itemLayoutView);
  
          return viewHolder;
      }
  
      @SuppressLint("UseValueOf") @Override
      public void onBindViewHolder(ViewHolder viewHolder,int position) {
  
          final int pos = position;
  
          viewHolder.tvQuestionNumber.setText(stList.get(position).getQuestionNumber());
  
          viewHolder.tvQuestion.setText(stList.get(position).getQuestion());
  
          viewHolder.rbAns1.setText(stList.get(position).getAnswer1());
  
          viewHolder.rbAns2.setText(stList.get(position).getAnswer2());
  
          viewHolder.rbAns3.setText(stList.get(position).getAnswer3());
  
          viewHolder.rbAns4.setText(stList.get(position).getAnswer4());
  
          viewHolder.rbAns5.setText(stList.get(position).getAnswer4());
  
          //viewHolder.rgAnswers.clearCheck();
  
          viewHolder.rgAnswers.check(stList.get(position).getSelectedRadioButtonId());
          viewHolder.rgAnswers.setTag(new Integer(position));
  
  
          Log.v("select"+position,stList.get(position).getSelectedRadioButtonId()+"");
  
          viewHolder.rgAnswers.setOnCheckedChangeListener(new OnCheckedChangeListener() {
  
              @Override
              public void onCheckedChanged(RadioGroup group, int checkedId) {
                  // TODO Auto-generated method stub
                  int radioButtonID = group.getCheckedRadioButtonId();
                  View radioButton = group.findViewById(radioButtonID);
                  int clickedPos = ((Integer)group.getTag()).intValue(); 
  
                  //Student contact=(Student)group.getTag();
  
                  //contact.setSelectedRadioButtonId(radioButtonID);
                  stList.get(clickedPos).setSelectedRadioButtonId(radioButtonID);
  
  
                  Log.v("hello"+clickedPos,stList.get(clickedPos).getSelectedRadioButtonId()+"");
              }
          });
  
      }
  
      // Return the size arraylist
      @Override
      public int getItemCount() {
          return stList.size();
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder {
  
          public TextView tvQuestionNumber;
          public TextView tvQuestion;
  
          public RadioGroup rgAnswers;
          public RadioButton rbAns1,rbAns2,rbAns3,rbAns4,rbAns5;
  
          public Student singlestudent;
  
          public ViewHolder(View itemLayoutView) {
              super(itemLayoutView);
  
              tvQuestionNumber = (TextView) itemLayoutView.findViewById(R.id.tvQuestionNumber);
  
              tvQuestion = (TextView) itemLayoutView.findViewById(R.id.tvQuestion);
              rgAnswers=(RadioGroup)itemLayoutView.findViewById(R.id.rgAnswers);
              rbAns1=(RadioButton)itemLayoutView.findViewById(R.id.rbAnswer1);
              rbAns2=(RadioButton)itemLayoutView.findViewById(R.id.rbAnswer2);
              rbAns3=(RadioButton)itemLayoutView.findViewById(R.id.rbAnswer3);
              rbAns4=(RadioButton)itemLayoutView.findViewById(R.id.rbAnswer4);
              rbAns5=(RadioButton)itemLayoutView.findViewById(R.id.rbAnswer5);
  
          }
  
      }
  
      // method to access in activity after updating selection
      public List&lt;Student&gt; getStudentist() {
          return stList;
      }
  
  }
  </code></pre>