title: How to get a value from RecyclerView
body: <p>I have created an app where you can order things. Then I have this section/window where you can see what you have already ordered: <a href="https://i.stack.imgur.com/7PnGC.jpg" rel="nofollow noreferrer">Overview</a></p>
  
  <p>When you click on an order, you can see more details:
  <a href="https://i.stack.imgur.com/St643.jpg" rel="nofollow noreferrer">Detailled overview</a></p>
  
  <p>But the problem is I don't get the 59 from the table from the first image. Does anyonew know how this can be done?</p>
  
  <p>Here is my adapter class:</p>
  
  <pre><code>public class UserBestellAdapter extends RecyclerView.Adapter&lt;UserBestellAdapter.ViewHolder&gt; {
  
      ArrayList&lt;Bestellung&gt; bestellung;
      Context mContext;
      Dialog epicDialog;
  
      public UserBestellAdapter(Context context, ArrayList&lt;Bestellung&gt; list) {
          mContext = context;
          bestellung = list;
          epicDialog = new Dialog(mContext);
      }
  
      @NonNull
      @Override
      public UserBestellAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(mContext).inflate(R.layout.adapter_bestell, parent, false);
          UserBestellAdapter.ViewHolder viewHolder = new UserBestellAdapter.ViewHolder(view);
  
  
          return viewHolder;
      }
      @NonNull
  
      @Override
      public void onBindViewHolder(@NonNull UserBestellAdapter.ViewHolder holder, int position) {
        //Gesamtpreis:   holder.item_betrag.setText(String.valueOf(bestellung.get(position).getBetrag()));
        // Datum:   holder.item_datum.setText(bestellung.get(position).getDatum());
          holder.item_items.setText(bestellung.get(position).getProdukte());
          //holder.item_code.setText(bestellung.get(position).getBestellnummer());
          String bestellid =bestellung.get(position).getBestellnummer() + "";
          holder.item_code.setText(bestellid);
          holder.item_betrag.setText(Double.toString(bestellung.get(position).getSumme()));
          holder.item_datum.setText(bestellung.get(position).getDatum());
  
  
          holder.layout_user_bestellung.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  TextView order_overview_number = epicDialog.findViewById(R.id.order_overview_number);
  
                  //order_overview_number.setText();
                  epicDialog.setContentView(R.layout.user_popup_order_overview);
                  epicDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
                  Button btn_order_overview_finish = (Button) epicDialog.findViewById(R.id.btn_order_overview_finish);
  
                  btn_order_overview_finish.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          epicDialog.dismiss();
                      }
  
                  });
                  epicDialog.show();
  
              }
          });
  
      }
  
      @Override
      public int getItemCount()  {
          return bestellung.size();
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder {
          private TextView item_items, item_betrag, item_datum, item_code;
          private ConstraintLayout layout_user_bestellung;
  
  
  
          public ViewHolder(@NonNull View itemView) {
              super(itemView);
              item_items = itemView.findViewById(R.id.items);
              item_betrag = itemView.findViewById(R.id.betrag);
              item_datum = itemView.findViewById(R.id.datum);
              item_code = itemView.findViewById(R.id.code);
              layout_user_bestellung = itemView.findViewById(R.id.layout_user_bestellung);
  
          }
      }
  }
  </code></pre>
  
  <p>And this is the fragment:</p>
  
  <pre><code>public class UserFragmentBestell&lt;Textview&gt; extends Fragment {
  
      RecyclerView recyclerView;
      TextView notfound;
  
      @Nullable
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.user_fragment_bestell, container, false);
          recyclerView = view.findViewById(R.id.recyclerview_scroll);
          notfound = view.findViewById(R.id.user_order_notfound);
          getBestellungen();
  
          return view;
  
      }
  
      //Abrufen aller Bestellungen eines Nutzers aus der Datenbank
      public void getBestellungen() {
          final FirebaseFirestore db = FirebaseFirestore.getInstance();
          final FirebaseAuth mAuth = FirebaseAuth.getInstance();
  
          db.collection("users").document(mAuth.getCurrentUser().getUid()).collection("bestellungen").orderBy("bestellnummer", Query.Direction.DESCENDING)
                      .get()
                      .addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
                              if (task.isSuccessful()) {
                                  ArrayList&lt;Bestellung&gt; list = new ArrayList&lt;&gt;();
                                  //Toast.makeText(getActivity(), "Bestellungen wurden gefunden!", Toast.LENGTH_SHORT).show();
                                  if(task.getResult().isEmpty()) {
                                      notfound.setVisibility(View.VISIBLE);
                                      Toast.makeText(getActivity(), "Es wurde keine Bestellung gefunden!", Toast.LENGTH_SHORT).show();
                                  }
  
  
  
                                  // ******LISTE WIRD ZWEIMAL AUFGERUFEN*******
                                  else {
                                      for (QueryDocumentSnapshot document : task.getResult()) {
                                          //Log.d(TAG, document.getId() + " =&gt; " + document.getData());
                                          Bestellung best = document.toObject(Bestellung.class);
                                          list.add(best);
                                          //System.out.println(bestellung[0] + bestellung[1] + bestellung[2]);
                                      }
                                      //System.out.println("Test: " + list.get(0).toString());
                                      //System.out.println("Test: " + list.get(1).toString());
                                      listeVerarbeiten(list);
                                      //Toast.makeText(getActivity(), "Bestellungen wurden gefunden!", Toast.LENGTH_SHORT).show();
                                  }
  
                              } else {
                                  Toast.makeText(getActivity(), "Es ist ein Fehler beim Abrufen der Bestellungen aufgetreten: " + task.getException().toString(), Toast.LENGTH_SHORT).show();
                                  //Log.w(TAG, "Error getting documents.", task.getException());
                              }
                          }
                      });
      }
  
      public void listeVerarbeiten(ArrayList&lt;Bestellung&gt; abrListe) {
  
          UserBestellAdapter adapter = new UserBestellAdapter(getContext(), abrListe);
          LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
          layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
          recyclerView.setLayoutManager(layoutManager);
          recyclerView.setAdapter(adapter);
      }
  
  }
  </code></pre>