Android - Populate recycler view problems












0















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".



Can someone help me please ?



Planning.java :



    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()>0){
eventsArrayList.clear();}
db.collection("Planning").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> 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);
}
}


RecyclerViewAdapter :



    @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"));
}
}









share|improve this question



























    0















    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".



    Can someone help me please ?



    Planning.java :



        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()>0){
    eventsArrayList.clear();}
    db.collection("Planning").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
    @Override
    public void onComplete(@NonNull Task<QuerySnapshot> 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);
    }
    }


    RecyclerViewAdapter :



        @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"));
    }
    }









    share|improve this question

























      0












      0








      0








      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".



      Can someone help me please ?



      Planning.java :



          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()>0){
      eventsArrayList.clear();}
      db.collection("Planning").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
      @Override
      public void onComplete(@NonNull Task<QuerySnapshot> 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);
      }
      }


      RecyclerViewAdapter :



          @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"));
      }
      }









      share|improve this question














      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".



      Can someone help me please ?



      Planning.java :



          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()>0){
      eventsArrayList.clear();}
      db.collection("Planning").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
      @Override
      public void onComplete(@NonNull Task<QuerySnapshot> 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);
      }
      }


      RecyclerViewAdapter :



          @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"));
      }
      }






      android firebase android-studio android-recyclerview google-cloud-firestore






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 23:05







      user9545141































          1 Answer
          1






          active

          oldest

          votes


















          0














          Without a proper stack trace, I could only assume either eventsArrayList.get(position).getHeure() or eventsArrayList.get(position).getDay() has returned null.



          If you think it crashes at eventsArrayList.get(position).getHeure(), you could try TextUtils.isEmpty instead, which also checks for null:



          if(TextUtils.isEmpty(eventsArrayList.get(position).getHeure())){
          holder.tvDate.setVisibility(View.GONE);
          holder.tvLieu.setVisibility(View.GONE);
          params.gravity = Gravity.CENTER;
          holder.tvNom.setLayoutParams(params);
          holder.cardView.setCardBackgroundColor(Color.parseColor("#227c97"));
          } else {
          // also you should update tvDate, tvLieu, tvNom and cardView
          // or you would get weird behaviour when the view holder is being recycled
          }


          If you think it crashes at eventsArrayList.get(position).getDay(), you could use TextUtils.equals:



          if (TextUtils.equals(eventsArrayList.get(position).getDay(), String.valueOf(cal.get(Calendar.DAY_OF_MONTH)))


          Most importantly, I'd not recommend RecyclerView.scrollTo in onBindViewHolder, it's a bad practice, you should perform this action else where. And maybe because you're trying to match a condition, and it can return null for other positions, so NPE occurs.






          share|improve this answer


























          • Thanks, based on your answer what i wanted to do works but i need to start 2 times the planning activity to make the recyclerview scroll to the position i want

            – user9545141
            Nov 15 '18 at 20:19











          • Do you know how to solve it ?

            – user9545141
            Nov 15 '18 at 20:20











          • I'm not too sure about you "need to start 2 times the planning activity" part..? If you're saying you have trouble scrolling the recycler view, you could try calling recyclerView.postDelayed(()->recyclerView.scrollToPosition(desired_position), 300); right after setting your adapter.

            – Aaron
            Nov 15 '18 at 20:36











          • I mean i need to intent my actvity planning, go back to my mainactivity and re-intent my planning activity to make the ScrollToPosition work

            – user9545141
            Nov 15 '18 at 21:15











          • And what you send doesn't work i don't know how to fix it but thanks for all you do for me =)

            – user9545141
            Nov 15 '18 at 21:17











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310059%2fandroid-populate-recycler-view-problems%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown
























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Without a proper stack trace, I could only assume either eventsArrayList.get(position).getHeure() or eventsArrayList.get(position).getDay() has returned null.



          If you think it crashes at eventsArrayList.get(position).getHeure(), you could try TextUtils.isEmpty instead, which also checks for null:



          if(TextUtils.isEmpty(eventsArrayList.get(position).getHeure())){
          holder.tvDate.setVisibility(View.GONE);
          holder.tvLieu.setVisibility(View.GONE);
          params.gravity = Gravity.CENTER;
          holder.tvNom.setLayoutParams(params);
          holder.cardView.setCardBackgroundColor(Color.parseColor("#227c97"));
          } else {
          // also you should update tvDate, tvLieu, tvNom and cardView
          // or you would get weird behaviour when the view holder is being recycled
          }


          If you think it crashes at eventsArrayList.get(position).getDay(), you could use TextUtils.equals:



          if (TextUtils.equals(eventsArrayList.get(position).getDay(), String.valueOf(cal.get(Calendar.DAY_OF_MONTH)))


          Most importantly, I'd not recommend RecyclerView.scrollTo in onBindViewHolder, it's a bad practice, you should perform this action else where. And maybe because you're trying to match a condition, and it can return null for other positions, so NPE occurs.






          share|improve this answer


























          • Thanks, based on your answer what i wanted to do works but i need to start 2 times the planning activity to make the recyclerview scroll to the position i want

            – user9545141
            Nov 15 '18 at 20:19











          • Do you know how to solve it ?

            – user9545141
            Nov 15 '18 at 20:20











          • I'm not too sure about you "need to start 2 times the planning activity" part..? If you're saying you have trouble scrolling the recycler view, you could try calling recyclerView.postDelayed(()->recyclerView.scrollToPosition(desired_position), 300); right after setting your adapter.

            – Aaron
            Nov 15 '18 at 20:36











          • I mean i need to intent my actvity planning, go back to my mainactivity and re-intent my planning activity to make the ScrollToPosition work

            – user9545141
            Nov 15 '18 at 21:15











          • And what you send doesn't work i don't know how to fix it but thanks for all you do for me =)

            – user9545141
            Nov 15 '18 at 21:17
















          0














          Without a proper stack trace, I could only assume either eventsArrayList.get(position).getHeure() or eventsArrayList.get(position).getDay() has returned null.



          If you think it crashes at eventsArrayList.get(position).getHeure(), you could try TextUtils.isEmpty instead, which also checks for null:



          if(TextUtils.isEmpty(eventsArrayList.get(position).getHeure())){
          holder.tvDate.setVisibility(View.GONE);
          holder.tvLieu.setVisibility(View.GONE);
          params.gravity = Gravity.CENTER;
          holder.tvNom.setLayoutParams(params);
          holder.cardView.setCardBackgroundColor(Color.parseColor("#227c97"));
          } else {
          // also you should update tvDate, tvLieu, tvNom and cardView
          // or you would get weird behaviour when the view holder is being recycled
          }


          If you think it crashes at eventsArrayList.get(position).getDay(), you could use TextUtils.equals:



          if (TextUtils.equals(eventsArrayList.get(position).getDay(), String.valueOf(cal.get(Calendar.DAY_OF_MONTH)))


          Most importantly, I'd not recommend RecyclerView.scrollTo in onBindViewHolder, it's a bad practice, you should perform this action else where. And maybe because you're trying to match a condition, and it can return null for other positions, so NPE occurs.






          share|improve this answer


























          • Thanks, based on your answer what i wanted to do works but i need to start 2 times the planning activity to make the recyclerview scroll to the position i want

            – user9545141
            Nov 15 '18 at 20:19











          • Do you know how to solve it ?

            – user9545141
            Nov 15 '18 at 20:20











          • I'm not too sure about you "need to start 2 times the planning activity" part..? If you're saying you have trouble scrolling the recycler view, you could try calling recyclerView.postDelayed(()->recyclerView.scrollToPosition(desired_position), 300); right after setting your adapter.

            – Aaron
            Nov 15 '18 at 20:36











          • I mean i need to intent my actvity planning, go back to my mainactivity and re-intent my planning activity to make the ScrollToPosition work

            – user9545141
            Nov 15 '18 at 21:15











          • And what you send doesn't work i don't know how to fix it but thanks for all you do for me =)

            – user9545141
            Nov 15 '18 at 21:17














          0












          0








          0







          Without a proper stack trace, I could only assume either eventsArrayList.get(position).getHeure() or eventsArrayList.get(position).getDay() has returned null.



          If you think it crashes at eventsArrayList.get(position).getHeure(), you could try TextUtils.isEmpty instead, which also checks for null:



          if(TextUtils.isEmpty(eventsArrayList.get(position).getHeure())){
          holder.tvDate.setVisibility(View.GONE);
          holder.tvLieu.setVisibility(View.GONE);
          params.gravity = Gravity.CENTER;
          holder.tvNom.setLayoutParams(params);
          holder.cardView.setCardBackgroundColor(Color.parseColor("#227c97"));
          } else {
          // also you should update tvDate, tvLieu, tvNom and cardView
          // or you would get weird behaviour when the view holder is being recycled
          }


          If you think it crashes at eventsArrayList.get(position).getDay(), you could use TextUtils.equals:



          if (TextUtils.equals(eventsArrayList.get(position).getDay(), String.valueOf(cal.get(Calendar.DAY_OF_MONTH)))


          Most importantly, I'd not recommend RecyclerView.scrollTo in onBindViewHolder, it's a bad practice, you should perform this action else where. And maybe because you're trying to match a condition, and it can return null for other positions, so NPE occurs.






          share|improve this answer















          Without a proper stack trace, I could only assume either eventsArrayList.get(position).getHeure() or eventsArrayList.get(position).getDay() has returned null.



          If you think it crashes at eventsArrayList.get(position).getHeure(), you could try TextUtils.isEmpty instead, which also checks for null:



          if(TextUtils.isEmpty(eventsArrayList.get(position).getHeure())){
          holder.tvDate.setVisibility(View.GONE);
          holder.tvLieu.setVisibility(View.GONE);
          params.gravity = Gravity.CENTER;
          holder.tvNom.setLayoutParams(params);
          holder.cardView.setCardBackgroundColor(Color.parseColor("#227c97"));
          } else {
          // also you should update tvDate, tvLieu, tvNom and cardView
          // or you would get weird behaviour when the view holder is being recycled
          }


          If you think it crashes at eventsArrayList.get(position).getDay(), you could use TextUtils.equals:



          if (TextUtils.equals(eventsArrayList.get(position).getDay(), String.valueOf(cal.get(Calendar.DAY_OF_MONTH)))


          Most importantly, I'd not recommend RecyclerView.scrollTo in onBindViewHolder, it's a bad practice, you should perform this action else where. And maybe because you're trying to match a condition, and it can return null for other positions, so NPE occurs.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 '18 at 0:11

























          answered Nov 15 '18 at 0:03









          AaronAaron

          1,7432212




          1,7432212













          • Thanks, based on your answer what i wanted to do works but i need to start 2 times the planning activity to make the recyclerview scroll to the position i want

            – user9545141
            Nov 15 '18 at 20:19











          • Do you know how to solve it ?

            – user9545141
            Nov 15 '18 at 20:20











          • I'm not too sure about you "need to start 2 times the planning activity" part..? If you're saying you have trouble scrolling the recycler view, you could try calling recyclerView.postDelayed(()->recyclerView.scrollToPosition(desired_position), 300); right after setting your adapter.

            – Aaron
            Nov 15 '18 at 20:36











          • I mean i need to intent my actvity planning, go back to my mainactivity and re-intent my planning activity to make the ScrollToPosition work

            – user9545141
            Nov 15 '18 at 21:15











          • And what you send doesn't work i don't know how to fix it but thanks for all you do for me =)

            – user9545141
            Nov 15 '18 at 21:17



















          • Thanks, based on your answer what i wanted to do works but i need to start 2 times the planning activity to make the recyclerview scroll to the position i want

            – user9545141
            Nov 15 '18 at 20:19











          • Do you know how to solve it ?

            – user9545141
            Nov 15 '18 at 20:20











          • I'm not too sure about you "need to start 2 times the planning activity" part..? If you're saying you have trouble scrolling the recycler view, you could try calling recyclerView.postDelayed(()->recyclerView.scrollToPosition(desired_position), 300); right after setting your adapter.

            – Aaron
            Nov 15 '18 at 20:36











          • I mean i need to intent my actvity planning, go back to my mainactivity and re-intent my planning activity to make the ScrollToPosition work

            – user9545141
            Nov 15 '18 at 21:15











          • And what you send doesn't work i don't know how to fix it but thanks for all you do for me =)

            – user9545141
            Nov 15 '18 at 21:17

















          Thanks, based on your answer what i wanted to do works but i need to start 2 times the planning activity to make the recyclerview scroll to the position i want

          – user9545141
          Nov 15 '18 at 20:19





          Thanks, based on your answer what i wanted to do works but i need to start 2 times the planning activity to make the recyclerview scroll to the position i want

          – user9545141
          Nov 15 '18 at 20:19













          Do you know how to solve it ?

          – user9545141
          Nov 15 '18 at 20:20





          Do you know how to solve it ?

          – user9545141
          Nov 15 '18 at 20:20













          I'm not too sure about you "need to start 2 times the planning activity" part..? If you're saying you have trouble scrolling the recycler view, you could try calling recyclerView.postDelayed(()->recyclerView.scrollToPosition(desired_position), 300); right after setting your adapter.

          – Aaron
          Nov 15 '18 at 20:36





          I'm not too sure about you "need to start 2 times the planning activity" part..? If you're saying you have trouble scrolling the recycler view, you could try calling recyclerView.postDelayed(()->recyclerView.scrollToPosition(desired_position), 300); right after setting your adapter.

          – Aaron
          Nov 15 '18 at 20:36













          I mean i need to intent my actvity planning, go back to my mainactivity and re-intent my planning activity to make the ScrollToPosition work

          – user9545141
          Nov 15 '18 at 21:15





          I mean i need to intent my actvity planning, go back to my mainactivity and re-intent my planning activity to make the ScrollToPosition work

          – user9545141
          Nov 15 '18 at 21:15













          And what you send doesn't work i don't know how to fix it but thanks for all you do for me =)

          – user9545141
          Nov 15 '18 at 21:17





          And what you send doesn't work i don't know how to fix it but thanks for all you do for me =)

          – user9545141
          Nov 15 '18 at 21:17




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310059%2fandroid-populate-recycler-view-problems%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine