title: Android - Populate recycler view problems
body: <p>I have done something doing that when arraylist.day == calendar.dayofmonth, it programmatically scroll into the arraylist position but when i start my activity i've got this error : "Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference".</p>
  
  <p>Can someone help me please ?</p>
  
  <p>Planning.java :</p>
  
  <pre><code>    public void setUpRecyclerView(){
      recyclerView = findViewById(R.id.recyclerView);
      recyclerView.setHasFixedSize(true);
      recyclerView.setLayoutManager(new LinearLayoutManager(this));
  }
  
  private void setUpFirebase(){
      db = FirebaseFirestore.getInstance();
  }
  
  private void loadDataFromFirebase(){
      if(eventsArrayList.size()&gt;0){
          eventsArrayList.clear();}
      db.collection("Planning").get().addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
          @Override
          public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
              for(DocumentSnapshot querySnapshot: task.getResult()){
                  Events Nom = new Events(querySnapshot.getString("Nom"),querySnapshot.getString("Lieu"),querySnapshot.getString("Heure"),querySnapshot.getString("Minute"),querySnapshot.getString("Day"));
                  eventsArrayList.add(Nom);
              }
              tvLoad.setVisibility(View.GONE);
              progressBar.setVisibility(View.GONE);
              adapter = new MyRecyclerViewAdapter(Planning.this, eventsArrayList);
              recyclerView.setAdapter(adapter);
              recyclerView.setItemAnimator(new DefaultItemAnimator());
          }
  }
  
      public void ScrollTo(int position){
      recyclerView.scrollToPosition(position);
  }
  }
  </code></pre>
  
  <p>RecyclerViewAdapter :</p>
  
  <pre><code>    @Override
  public void onBindViewHolder(@NonNull MyRecyclerViewHolder holder, int position) {
      Calendar cal = Calendar.getInstance();
      holder.tvLieu.setVisibility(View.VISIBLE);
      holder.tvDate.setVisibility(View.VISIBLE);
      holder.cardView.setCardBackgroundColor(Color.WHITE);
      LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) holder.tvNom.getLayoutParams();
      params.gravity = Gravity.START;
      holder.tvNom.setLayoutParams(params);
      if(eventsArrayList.get(position).getDay().equals(String.valueOf(cal.get(Calendar.DAY_OF_MONTH)))) { planning.ScrollTo(position); }
      holder.tvNom.setText(eventsArrayList.get(position).getNom());
      holder.tvLieu.setText(eventsArrayList.get(position).getLieu());
      holder.tvDate.setText(eventsArrayList.get(position).getHeure() + "h" + eventsArrayList.get(position).getMinute());
      if(eventsArrayList.get(position).getHeure().equals("")){
          holder.tvDate.setVisibility(View.GONE);
          holder.tvLieu.setVisibility(View.GONE);
          params.gravity = Gravity.CENTER;
          holder.tvNom.setLayoutParams(params);
          holder.cardView.setCardBackgroundColor(Color.parseColor("#227c97"));
      }
  }
  </code></pre>