title: Images loaded with picasso in recycler view in android disappear when changing visibility of a view within the listitem
body: <p>So i have a recycler view loaded with items containing text and image and a checkbox. All the data is loaded just fine initially including the images using picasso. The checkbox is initially hidden, once i tap a button, which is not part of the recycler view. The checkboxes should appear in all the items of recycler view. Everything works fine except for the fact that the images disappear once i do that. </p>
  
  <p>The way i am doing it is that i set the adapter to my recyclerview to null and then initialize a new recycler view adapter which has checkboxes visible and set it to my recycler view. </p>
  
  <p>The same thing happens if i try to search for a particular list item using a search bar on top. Any idea why? Here is the code about how i am setting the adapter to my recycler view.</p>
  
  <pre><code>  // set the adapter to null on cards list view.
    cards_list_view.setAdapter(null);
  
   // Initialize the adapter again.
   deckCardRecycleAdapter = new DeckCardRecycleAdapter(getActivity(), cards_list, show_checkbox);
  
  // Set the adapter again to list view.                          
   cards_list_view.setAdapter(deckCardRecycleAdapter);
  </code></pre>
  
  <p>And here is my onBindViewHolder function in adapter.</p>
  
  <pre><code> @Override
  public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
  
      typeface = Typeface.createFromAsset(context.getAssets(), "fonts/futura-medium.otf");
  
      viewHolder.user_name.setTypeface(typeface);
      viewHolder.user_name.setText(cards.get(position).getName().toString());
  
      viewHolder.position.setTypeface(typeface);
      viewHolder.position.setText(cards.get(position).getPosition().toString());
  
      viewHolder.dot.setTypeface(typeface);
  
      viewHolder.event_saved.setTypeface(typeface);
  
      if(cards.get(position).getEvent_name().toString().equals("None")) {
          viewHolder.event_saved.setVisibility(View.GONE);
          viewHolder.dot.setVisibility(View.GONE);
      }
      else
          viewHolder.event_saved.setText(cards.get(position).getEvent_name().toString());
  
      viewHolder.date_saved.setTypeface(typeface);
      String timestamp = cards.get(position).getTimestamp().toString();
      viewHolder.date_saved.setText(toDate(timestamp));
  
  
      if(cards.get(position).image_url.toString().equals("None"))
          viewHolder.user_image.setImageResource(R.drawable.anonymous);
      else {
  
          String url_image = cards.get(position).image_url.toString();
          Picasso.with(this.context).cancelRequest(viewHolder.user_image);
          Picasso.with(context).load(url_image).into(new Target() {
              @Override
              public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
  
                  viewHolder.user_image.setImageBitmap(bitmap);
                  cards.get(position).setImage_url(getStringImage(bitmap));
              }
  
              @Override
              public void onBitmapFailed(Drawable errorDrawable) {
  
              }
  
              @Override
              public void onPrepareLoad(Drawable placeHolderDrawable) {
  
              }
          });
  
      }
  </code></pre>
  
  <p>Please help. Thanks in advance. </p>