title: Remove item from gridview
body: <p>I'm removing images from a gridview when a button is pressed.</p>
  
  <p>The images does remove fine and the gridview also updates with the call "adapter.notifyDataSetChanged();".</p>
  
  <p>When an imageview is removed another image next to this position should take its position. This happens, but the image here won't reload so there's just a blank space? How can I get this imageview to reload its image?</p>
  
  <p>The problem:<a href="https://i.stack.imgur.com/c3TiC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c3TiC.png" alt="enter image description here"></a></p>
  
  <p>Here is my gridadapter:</p>
  
  <pre><code>public class FavoriteMovieGridAdapter extends BaseAdapter {
  Context context;
  ArrayList&lt;DataFavorites&gt; List;
  FavoritesMovie fragment;
  private static LayoutInflater inflater = null;
  FavoriteMovieGridAdapter adapter = this;
  
  
  public FavoriteMovieGridAdapter(Context context, ArrayList&lt;DataFavorites&gt; List, FavoritesMovie fragment) {
      this.context = context;
      this.List = List;
      this.fragment = fragment;
      inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }
  
  
  
  @Override
  public int getCount() {
      // TODO Auto-generated method stub
      return List.size();
  }
  
  @Override
  public Object getItem(int position) {
      // TODO Auto-generated method stub
      return position;
  }
  
  @Override
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return position;
  }
  
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
  
      // Avoid unneccessary calls to findViewById() on each row
      final ViewHolder holder;
  
      /*
       * If convertView is not null, reuse it directly, no inflation
       * Only inflate a new View when the convertView is null.
       */
  
      if (convertView == null) {
          convertView = inflater.inflate(R.layout.favorite_grid_item, null);
  
          holder = new ViewHolder();
          holder.poster = (ImageView) convertView.findViewById(R.id.upcoming_image);
  
          holder.editbutton = (ImageView) convertView.findViewById(R.id.delete_item);
          // The tag can be any Object, this just happens to be the ViewHolder
          convertView.setTag(holder);
      }
      else{
  
          // Get the ViewHolder back to get fast access to the TextView
          // and the ImageView.
          holder = (ViewHolder) convertView.getTag();
  
      }
  
  
      final View finalConvertView = convertView;
  
      final DataFavorites e;
      new DataFavorites();
      e = List.get(position);
  
      String url = String.valueOf(e.getUrl());
  
      // load image url into poster
  
  // Seems as if this doesn't run for the imageview next to this when this view is removed?              
    Picasso.with(context).load(url).fit().placeholder(R.drawable.movie_back).into(holder.poster);
  
      // Create onclick and show edit button
  
      convertView.setOnLongClickListener(new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
  
  
       // show edit button
       holder.editbutton.setVisibility(View.VISIBLE);
  
       YoYo.with(Techniques.FadeIn).duration(700).playOn(finalConvertView.findViewById(R.id.delete_item));
  
  
  
              // onclick edit button remove item and update gridview
       holder.editbutton.setOnClickListener(new View.OnClickListener() {
  
       @Override
       public void onClick(View v) {
  
        YoYo.with(Techniques.ZoomOut).duration(700).playOn(finalConvertView.findViewById(R.id.favorite_relative));
  
  
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
                          public void run() {
  
  
         adapter.List.remove(e);
         adapter.notifyDataSetChanged();
  
  
          // Delete specific movie from data base
          DatabaseHandlerMovie db = new DatabaseHandlerMovie(context);
          // Reading all movies
          db.deleteMovie(e);
  
              }
                      }, 1000);
  
  
  
  
                  }
              });
  
              return false;
          }
      });
  
  
      return convertView;
  }
  
  static class ViewHolder {
      ImageView poster;
      ImageView editbutton;
  }
  
  
  
  }
  </code></pre>
  
  <p>My grid item layout:</p>
  
  <pre><code>&lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  android:id="@+id/favorite_relative"
  android:layout_centerHorizontal="true"
  android:gravity="center_horizontal"&gt;
  
  
  
  &lt;ImageView android:layout_width="123.3dp"
      android:layout_height="185.3dp"
      android:id="@+id/upcoming_image"
      android:scaleType="fitXY" /&gt;
  
  &lt;ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/delete_item"
      android:src="@drawable/ic_remove_circle_outline_white_24dp"
      android:tint="@color/colorPrimaryDark"
      android:clickable="true"
      android:visibility="gone"
      android:layout_alignRight="@+id/upcoming_image"
      android:layout_alignEnd="@+id/upcoming_image"/&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>My grid layout:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  tools:context=".Favorites"
  android:background="#FFFFFF"
  android:focusableInTouchMode="true"&gt;
  
  
  
  &lt;GridView
  
      android:layout_width="match_parent"
      android:layout_height="fill_parent"
      android:id="@+id/movies_gridlayout"
      android:paddingRight="-1dp"
      android:paddingEnd="-1dp"
      android:numColumns="3"
      android:background="#ffffff"
      android:visibility="invisible"/&gt;
  
  
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:id="@+id/favorite_none"
      android:text="No favorite movies found"
      android:textSize="15sp"
      android:visibility="gone"
      android:textColor="@color/SecondaryText"
      /&gt;
  
  
  &lt;ProgressBar
          android:id="@+id/progressBar"
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:visibility="gone"
          &gt;
      &lt;/ProgressBar&gt;
      &lt;/FrameLayout&gt;
  </code></pre>