title: Updating RecyclerView when activity resumes?
body: <p>I have a <code>QuestionActivity</code> were I show the list of questions in the <code>RecyclerView</code>.</p>
  
  <p>I have two action in toolbar </p>
  
  <ol>
  <li><p>Go to downloadedFile activity. </p></li>
  <li><p>Go to favorite activity.</p></li>
  </ol>
  
  <p>Every thing is OK but when I hit one of that actions and return to <code>QuestionActivity</code> the <code>RecyclerView</code> couldn't get updated.</p>
  
  <p>So I need to override <code>OnResume</code> Method. My question is, How can I update <code>RecyclerView</code> in <code>onResume</code> Method .</p>
  
  <p><code>AdapterRecyclerQuestion</code> code :</p>
  
  <pre><code>public class AdapterRecyclerQuestion extends RecyclerView.Adapter&lt;AdapterRecyclerQuestion.ViewHolder&gt; {
  
      private Context context;
      private ArrayList&lt;ModelQuestion&gt; questionha;
      private int lastd;
  
  
      ////////////////////////////////////////////////////////////
      //================== Constructor   =========================
      ////////////////////////////////////////////////////////////
  
      public AdapterRecyclerQuestion(Context context, ArrayList&lt;ModelQuestion&gt; questionha) {
          this.context = context;
          this.questionha = questionha;
      }
  
      ////////////////////////////////////////////////////////////
      //================== view holder  =========================
      ////////////////////////////////////////////////////////////
  
      public class ViewHolder extends RecyclerView.ViewHolder {
          private TextView txtTitle;
          private TextView txtDesc;
          private TextView txtCntDown;
          private Button btnDownload;
          private ImageView imgAddFav;
          private ProgressBar prgDownload;
  
          ////////////////////////////////////////////////////////////
          //================== View holder constructor  ==============
          ////////////////////////////////////////////////////////////
  
          public ViewHolder(View itemView) {
              super(itemView);
              txtTitle = (TextView) itemView.findViewById(R.id.txt_title_question);
              txtDesc = (TextView) itemView.findViewById(R.id.txt_desc_question);
              txtCntDown = (TextView) itemView.findViewById(R.id.txt_cnt_down_question_dy);
              btnDownload = (Button) itemView.findViewById(R.id.btn_down_question);
              imgAddFav = (ImageView) itemView.findViewById(R.id.img_add_to_fav);
              prgDownload = (ProgressBar) itemView.findViewById(R.id.prgDownload);
          }
      }
      ////////////////////////////////////////////////////////////
      //================== on create view holder  ================
      ////////////////////////////////////////////////////////////
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.question_row, parent, false);
          return new ViewHolder(view);
      }
  
      ////////////////////////////////////////////////////////////
      //================== on bind view holder  =================
      ////////////////////////////////////////////////////////////
  
      @Override
      public void onBindViewHolder(final ViewHolder holder, final int position) {
  
  
          QuestionDatabaseAdapter questionDatabaseAdapter = new QuestionDatabaseAdapter(holder.itemView.getContext());
  
          holder.txtTitle.setText(questionha.get(position).getQuestionTitle());
          holder.txtDesc.setText(questionha.get(position).getQuestionDesc());
          holder.txtCntDown.setText(questionha.get(position).getQuestionDownCnt());
  
          ////////////////////////////////////////////////////////////
          //================== Favorite checking  ====================
          ////////////////////////////////////////////////////////////
  
  
          boolean isFavorite = questionDatabaseAdapter.isQuestionFavorite(questionha.get(position).getQuestionId());
  
          if (isFavorite)
  
          {
              holder.imgAddFav.setImageResource(R.drawable.ic_favorite_red_700_24dp);
          } else
  
          {
              holder.imgAddFav.setImageResource(R.drawable.ic_favorite_border_red_a700_24dp);
          }
  
  
          ////////////////////////////////////////////////////////////
          //================== img add fav listener  =================
          ////////////////////////////////////////////////////////////
  
          holder.imgAddFav.setOnClickListener(new View.OnClickListener() {
  
                                                  @Override
                                                  public void onClick(View v) {
  
                                                      QuestionDatabaseAdapter databaseAdapter = new QuestionDatabaseAdapter(v.getContext());
                                                      boolean isFav = databaseAdapter.isQuestionFavorite(questionha.get(position).getQuestionId());
  
                                                      if (!isFav) {
                                                          Toast.makeText(v.getContext(), "به لیست علاقه مندی ها اضافه شد", Toast.LENGTH_SHORT).show();
                                                          holder.imgAddFav.setImageResource(R.drawable.ic_favorite_red_700_24dp);
                                                          ModelQuestion question = new ModelQuestion();
  
                                                          question.setQuestionId(questionha.get(position).getQuestionId());
                                                          question.setQuestionTitle(questionha.get(position).getQuestionTitle());
                                                          question.setQuestionDesc(questionha.get(position).getQuestionDesc());
                                                          question.setQuestionDownLink(questionha.get(position).getQuestionDownLink());
                                                          question.setQuestionDownFileName(questionha.get(position).getQuestionDownFileName());
  
                                                          databaseAdapter.saveQuestion(question);
                                                      } else {
                                                          Toast.makeText(v.getContext(), "از لیست علاقه مندی ها پاک شد", Toast.LENGTH_SHORT).show();
                                                          holder.imgAddFav.setImageResource(R.drawable.ic_favorite_border_red_a700_24dp);
                                                          databaseAdapter.deleteQuestion(questionha.get(position).getQuestionId());
                                                      }
                                                  }
                                              }
          );
      }
  
      ////////////////////////////////////////////////////////////
      //================== get item count method  ================
      ////////////////////////////////////////////////////////////
      @Override
      public int getItemCount() {
          if (questionha.size() == 0) {
              return 0;
          } else {
              return questionha.size();
          }
      }
  }
  </code></pre>
  
  <p>Thanks. </p>