title: Update Firestore field inside a RecycleView
body: <p>I want to update a field inside my Firestore when OnClick is happening.
  The problem is that I don't know how to retrieve id of my actual item, because this is auto-generated. ( I want to update <em>assignedTo</em> field ). The structure of Firestore is the following: <a href="https://i.stack.imgur.com/Wo76v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wo76v.png" alt="enter image description here"></a>:</p>
  
  <p>A code snippet with my Adapter of my <code>RecyclerView</code> is:</p>
  
  <pre><code>public class AvailableTaskListAdapter extends RecyclerView.Adapter&lt;AvailableTaskListAdapter.ViewHolder&gt; {
  public List&lt;Task&gt; taskList;
  Activity mActivity;
  FirebaseFirestore firestore;
  
  public AvailableTaskListAdapter(List&lt;Task&gt; taskList, Context mContext, FirebaseFirestore firestore) {
      this.taskList = taskList;
      this.mActivity = (Activity) mContext;
      this.firestore = firestore;
  }
  
  @NonNull
  @Override
  public AvailableTaskListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
      View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_available_tasks_item, viewGroup, false);
      view.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
  
              //HERE I want to be happening the update of my field.
  
  
          }
      });
      return new AvailableTaskListAdapter.ViewHolder(view);
  
  }
  
  @Override
  public void onBindViewHolder(@NonNull AvailableTaskListAdapter.ViewHolder viewHolder, int i) {
      viewHolder.tvEmail.setText(taskList.get(i).getUser());
      ...
  }
  
  @Override
  public int getItemCount() {
      return taskList.size();
  }
  
  public class ViewHolder extends RecyclerView.ViewHolder {
      View mView;
  
      public TextView tvEmail;
      ...
  
      public ViewHolder(View itemView) {
          super(itemView);
          mView = itemView;
  
          tvEmail = (TextView) mView.findViewById(R.id.tvEmail);
          ...
      }
  }
  
  public void showDialog(final Activity activity) {
      final Dialog dialog = new Dialog(activity);
      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
      dialog.setCancelable(false);
      dialog.setContentView(R.layout.dialog_apply_to_task);
      dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
  
      FrameLayout mDialogNo = dialog.findViewById(R.id.frmNo);
      mDialogNo.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              Toast.makeText(activity.getApplicationContext(),"Cancel" ,Toast.LENGTH_SHORT).show();
              dialog.dismiss();
          }
      });
  
      FrameLayout mDialogOk = dialog.findViewById(R.id.frmOk);
      mDialogOk.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Toast.makeText(activity.getApplicationContext(),"Okay" ,Toast.LENGTH_SHORT).show();
              dialog.cancel();
          }
      });
  
      dialog.show();
  }}
  </code></pre>