There are answers of this questions but none of them solved my problem .Below is my code .
  public class QuizAdapter extends RecyclerView.Adapter<QuizAdapter.MyViewHolder> {
Context context;
private List<Quiz_G_S> quiz_g_sList = null;
int selectedPosition = -1;
public QuizAdapter(Context context, List<Quiz_G_S> list) {
    this.context = context;
    this.quiz_g_sList = list;
}
@Override
public QuizAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.quiz_single_row, parent, false);
    return new MyViewHolder(itemView);
}
@Override
public void onBindViewHolder(final QuizAdapter.MyViewHolder holder, int position) {
    final int pos = position;
    holder.answers.setText(quiz_g_sList.get(pos).getMCQ());
    holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            quiz_g_sList.get(pos).setChecked(true);
        }
    });
    if (quiz_g_sList.get(pos).isChecked()) {
        holder.checkBox.setChecked(true);
        notifyDataSetChanged();
    } else {
        holder.checkBox.setChecked(false);
    }
}
@Override
public int getItemCount() {
    return quiz_g_sList.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
    TextView answers;
    CheckBox checkBox;
    public MyViewHolder(View v) {
        super(v);
        answers = (TextView) v.findViewById(R.id.quiz_adap_ans);
        checkBox = (CheckBox) v.findViewById(R.id.quiz_adap_check);
    }
}
Above is my adapter code.
This is my Quiz_G_S class
public class Quiz_G_S {
String MCQ;
int Rank;
boolean checked;
public boolean isChecked() {
    return checked;
}
public void setChecked(boolean checked) {
    this.checked = checked;
}
public String getMCQ() {
    return MCQ;
}
public void setMCQ(String mcq) {
    this.MCQ = mcq;
}
public int getRank() {
    return Rank;
}
public void setRank(int rank) {
    this.Rank = rank;
}
}
What i want to do is if i check a checkbox then all checkboxes will set unchecked except the one I checked There is an error on notifyDataSetChanged. I guess the logic is right but i don't know how to refresh checkbox state.The only thing I know is notifyDataSetChanged is there any other method to refresh or is there any workaround for this problem
 
     
     
     
    