title: pass data from recyclerview to new activity after radio button press
body: <p>I have a recyclerview with radiobutton,the aim is to have a pop-up(dialogue) appear anytime the user selects the "non-appropriate" radio button, from which options would appear and based on the users selection from those options, a new activity will be opened with the info from the recyclerview.</p>
  
  <p>So far, i have been able to do the dialogue and activities, but where i have an issue is getting the data from the recyclerview into the new activity.</p>
  
  <p>I have read similar threads and none had the answer i need.</p>
  
  <p><a href="https://stackoverflow.com/questions/51499991/pass-data-from-dialog-to-new-activity">Pass Data from Dialog to new Activity</a></p>
  
  <p><a href="https://stackoverflow.com/questions/40541581/recyclerview-click-to-pass-data-to-new-activity">RecyclerView Click to pass data to new activity</a></p>
  
  <p>Main Activity</p>
  
  <pre><code>////Firebase Adapter and related properties
  
          FirebaseRecyclerOptions&lt;Drugs&gt; options = new FirebaseRecyclerOptions.Builder&lt;Drugs&gt;()
                  .setQuery(query, Drugs.class).build();
  
          adapter = new FirebaseRecyclerAdapter&lt;Drugs, DrugsViewHolder&gt;(options) {
              @Override
              protected void onBindViewHolder(@NonNull DrugsViewHolder holder, final int position, @NonNull Drugs model) {
                  holder.setDiag1(model.getBrand());
                  holder.setDiag2(model.getGeneric());
                  holder.setDiag3(model.getDose());
                  holder.setDiag4(model.getFrequency1(), model.getFrequency2(), model.getDuration());
  
  
  
              }
  
              @NonNull
              @Override
              public DrugsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
  
                  ////Recycler view item
                  View view = LayoutInflater.from(viewGroup.getContext())
                          .inflate(R.layout.drug_display_list,viewGroup,false);///
                  return new DrugsViewHolder(view);
              }
          };
  
          patient_drug_list.setLayoutManager(new LinearLayoutManager(this));
          patient_drug_list.setAdapter(adapter);//// setting adapter
          adapter.notifyDataSetChanged();
          adapter.startListening();
      }
  
      @Override
      protected void onStart() {
          super.onStart();
          adapter.startListening();
          adapter.notifyDataSetChanged();
      }
  
      public void rbclick(View view) {
          ////Activated when ever a user presses the "non-appropriate" radiobutton
  
          AlertDialog.Builder myDialog = new AlertDialog.Builder(Review2.this);
          LayoutInflater inflater = LayoutInflater.from(Review2.this);
          View myview = inflater.inflate(R.layout.adr_options, null);
          myDialog.setView(myview);
          myDialog.show();
  
      }
  
  
  ////////////////click for new option activities
  
             //This is a switch for the adio button options that appear after the above radiobutton
      public void clickers(View view) {
          switch (view.getId()){
              case  R.id.drug_needed:
                  startActivity(new Intent(getApplicationContext(),Drug_needed.class));
                  break;
  
  
              case R.id.wrong_drug:
                  Toast.makeText(Review2.this, "2nd", Toast.LENGTH_SHORT).show();
                  break;
  
              case R.id.dose_related:
                  startActivity(new Intent(getApplicationContext(),Dose.class));
                  break;
              case R.id.adverse_reaction:
                  startActivity(new Intent(getApplicationContext(),ADR.class));
                  break;
  
              case R.id.food_interaction:
                  Toast.makeText(this, "yet to do", Toast.LENGTH_SHORT).show();
                  break;
  
              default:
                  Toast.makeText(Review2.this, "nothing to see", Toast.LENGTH_SHORT).show();
                  break;
          }
      }
  
  
      ////////////////View Holder
  
      private class DrugsViewHolder extends  RecyclerView.ViewHolder{
          View mView;
          DrugsViewHolder(@NonNull View itemView) {
              super(itemView);
              mView = itemView;
  
  
  
          }
  
  
  
          void setDiag1(String diag1){
              TextView postdiag1 = mView.findViewById(R.id.brand);
              postdiag1.setText(diag1);
  
          }
          void setDiag2(String diag2){
              TextView postdiag2 = mView.findViewById(R.id.generic);
              postdiag2.setText(diag2);
              postdiag2.setTextSize(12);
          }
          public void setDiag3(String diag3){
              TextView postdiag3 = mView.findViewById(R.id.dose);
              postdiag3.setText("Dose:" + diag3);
          }
          public void setDiag4(String diag4, String diag5, String diag6){
              TextView postdiag4 = mView.findViewById(R.id.frequency);
              postdiag4.setText("Frequency:" + diag4 + " tab " + diag5+"x" + "daily for "+diag6 + "days");
          }
      }
  </code></pre>
  
  <p>Recyclerview layout(showing only the radiobuttons with onClick function)</p>
  
  <pre><code>    &lt;RadioGroup
          android:id="@+id/radio_appropriate"
          android:layout_below="@+id/view2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="horizontal"&gt;
          &lt;RadioButton
              android:id="@+id/appropraite"
              android:layout_weight="1"
              android:textSize="15sp"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Appropriate"
              android:textColor="@color/cool_blue"
              android:layout_margin="10dp"/&gt;
  
          &lt;RadioButton
              android:onClick="rbclick"
              android:id="@+id/not_appropriate"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="10dp"
              android:layout_weight="1"
              android:text="Inapropriate"
              android:textColor="@color/cool_blue" /&gt;
  
      &lt;/RadioGroup&gt;
  </code></pre>
  
  <p>Below is a picture summary of what i want to do</p>
  
  <p><a href="https://i.stack.imgur.com/tZ8LW.jpg" rel="nofollow noreferrer">Selecting the "non appropriate" radiobutton</a></p>
  
  <p><a href="https://i.stack.imgur.com/KpYjb.png" rel="nofollow noreferrer">Dialogue after selecting the radiobutton from recyclerview</a></p>
  
  <p><a href="https://i.stack.imgur.com/aPsob.jpg" rel="nofollow noreferrer">What should happen(what am expecting)</a></p>
  
  <p>Any ideas or suggestions or links on how i should go about it would be appreciated.</p>