title: Update item count of Recyclerview
body: <p>i'm trying to implement search feature in my app,but i am having a problem. </p>
  
  <p>For example when i search to <em>yellow flowers</em> i get 200 result found, i store 200 in <strong>NumberWalls</strong> variable,to ;to make adapter show only 200 item in <code>RecyclerView</code>.and everthing works fin, my problem is when i search for example <em>Google Picture</em> i get 4 result found and when i search again for <em>yellow flowers</em> i see only 4 item on <code>RecyclerView</code> instead of 200.</p>
  
  <pre><code> private void setAdapterForRecyclerView(List&lt;Wallpaper&gt; wlls, int NumberWalls) {
  
          if (myAdapter == null) {
              errortv.setVisibility(View.GONE);
              myAdapter = new MyAdapterSearch(wlls, getApplicationContext(), new RecyclerViewClickListener() {
                  @Override
                  public void onClick(View view, Wallpaper wallpaper) {
                      Intent intent = new Intent(Search.this, FullScreen.class);
                      intent.putExtra("img", wallpaper.getThumbnails());
                      intent.putExtra("tags", wallpaper.getTitle());
                      startActivity(intent);
                  }
  
                  @Override
                  public void onClick(View view, Category categories) {
  
                  }
              }, (NumberWalls));
              recyclerView.setAdapter(myAdapter);
  
          } else {
              int position = myAdapter.getItemCount();
              myAdapter.getItems().addAll(wlls);
              myAdapter.notifyItemRangeInserted(position, NumberWalls);
          }
          progressbar.setVisibility(View.GONE);
      }
  </code></pre>
  
  <p>in Adapter : </p>
  
  <pre><code>public MyAdapterSearch(List&lt;Wallpaper&gt; wallpapers, Context context, RecyclerViewClickListener clickListener, int numberItem) {
          this.wallpapers = wallpapers;
          this.context = context;
          this.mClickListener = clickListener;
          this.numberItem = numberItem;
      }
      .
      .
      .
  
  @Override
      public int getItemCount() {
          return Math.min(wallpapers.size(), numberItem);
      }
  </code></pre>
  
  <p>here's the <code>AsyncTask</code> class where i get <strong>NumberWalls</strong> : </p>
  
  <pre><code>public class fetchDataSearch extends AsyncTask&lt;Integer, List&lt;Wallpaper&gt;, List&lt;Wallpaper&gt;&gt; {
          Document doc = null;
          ArrayList&lt;Wallpaper&gt; urlsSearch = new ArrayList&lt;&gt;();
          String numberOnly;
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
          }
  
          @Override
          protected List&lt;Wallpaper&gt; doInBackground(Integer... integers) {
              try {
                  doc = Jsoup.connect(getResources().getString(R.string.SearchRequest) + mSearchText.replace(" ", "+") + "&amp;page=" + integers[0]).get();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              if (doc != null) {
                  Element noResultfound = doc.getElementsByClass("notice notice-error").first();
                  if (noResultfound != null) {
                      noResultsFoundCatched = true;
                  } else {
                      Element element = doc.select("div.center &gt; h1").first();
                      numberOnly = element.text().replaceFirst(".*?(\\d+).*", "$1");
                      Elements newsHeadlines = doc.getElementsByClass("img-responsive");
                      for (Element headline : newsHeadlines) {
                          String thumb = headline.select("img").attr("src");
                          String title = headline.select("img").attr("title");
                          Wallpaper wallpaperInfo = new Wallpaper();
                          wallpaperInfo.setThumbnails(thumb);
                          wallpaperInfo.setTitle(title);
                          if (BooleanChecker.checkTagsContains(title)) {
                              urlsSearch.add(wallpaperInfo);
                          } else {
                              unWantedTagsFound++;
                          }
                      }
                      noResultsFoundCatched = false;
                  }
  
              } else {
                  noResultsFoundCatched = true;
              }
              return urlsSearch;
          }
  
          @Override
          protected void onPostExecute(List&lt;Wallpaper&gt; wallpapersSearch) {
              super.onPostExecute(wallpapersSearch);
              if (numberOnly != null) {
                  numberWallpapersPage = Integer.parseInt(numberOnly);
                  setAdapterForRecyclerView(wallpapersSearch, numberWallpapers);
              } 
          }
      }
  </code></pre>