RecyclerView is not refreshing
<p>In my application I receive some data from a web server. This data is sent to a <code>RecyclerView</code>. Firstly, all data is displayed fine. However, when I try to refresh it, the data no-longer shows. The data arrives from the web service (as verified using Logcat).</p>

<h2>Setting the data</h2>

<pre><code>ArrayList&lt;FoodItem&gt; allFood = response.body();
if(foodAdapter != null) {
    foodAdapter.swap(allFood);
} else {
    foodAdapter = new FoodAdapter(FoodViewForCustomerActivity.this, allFood);
}
photoCollectionView.setAdapter(foodAdapter);
</code></pre>

<h2>My <code>RecyclerView</code> Adapter</h2>

<pre><code>public class FoodAdapter extends RecyclerView.Adapter&lt;FoodAdapter.ViewHolder&gt; {
    Context mContext;
    ArrayList&lt;FoodItem&gt; foodItems;

    public FoodAdapter(Context context, ArrayList&lt;FoodItem&gt; foodItems) {
        this.mContext = context;
        this.foodItems = foodItems;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.food_item_row, parent, false);
        return new ViewHolder(view);
    }

    public void swap(ArrayList&lt;FoodItem&gt; newFoods) {
        foodItems.clear();
        foodItems.addAll(newFoods);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                notifyDataSetChanged();
            }
        }, 500);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, final int position) {
        FoodItem foodItem = foodItems.get(position);
        String stringPicture = foodItem.getPhoto();
        byte[] decodedPictureStringArray = Base64.decode(stringPicture, Base64.DEFAULT);
        Bitmap bitmapPhoto = BitmapFactory.decodeByteArray(decodedPictureStringArray, 0, decodedPictureStringArray.length);
        Uri photoUri = getImageUri(mContext, bitmapPhoto);
        Picasso.with(mContext).load(photoUri).resize(300, 300)
            .centerCrop().into(holder.foodImage);
        holder.foodItemNameText.setText(foodItem.getFoodItemName());
        holder.foodPriceText.setText(foodItem.getUnitPrice() + " / " + foodItem.getUnitType());
    }
    public Uri getImageUri(Context inContext, Bitmap inImage) {
        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        inImage.compress(Bitmap.CompressFormat.JPEG, 10, bytes);
        String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
        return Uri.parse(path);
    }

    @Override
    public int getItemCount() {
        return foodItems.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        public ImageView foodImage;
        public TextView foodItemNameText;
        public TextView foodPriceText;

        public ViewHolder(View itemView) {
            super(itemView);
            foodImage = (ImageView) itemView.findViewById(R.id.foodPhoto);
            foodItemNameText = (TextView) itemView.findViewById(R.id.foodItemNameText);
            foodPriceText = (TextView) itemView.findViewById(R.id.foodPriceText);
        }
    }
}
</code></pre>

<h2>The <code>RelativeLayout</code> that contains my <code>Toolbar</code> and <code>RecyclerView</code></h2>

<pre><code>    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  tools:context=".FoodViewForCustomerActivity"&gt;

  &lt;include
      android:id="@+id/toolbar"
      layout="@layout/toolbar"
      /&gt;
  &lt;android.support.v7.widget.RecyclerView
      android:layout_below="@id/toolbar"
      android:id="@+id/photoCollectionView"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#f8f8f8"
      android:divider="@null"
      android:listSelector="@android:color/transparent"/&gt;
&lt;/RelativeLayout&gt;
</code></pre>