title: Android : Issue deleting last item from RecyclerView
body: <p>I am using the <code>RecyclerView</code> in the following manner to show a list of Places items that are updated in <strong>SQLite DB</strong> . </p>
  
  <p>The items are deleted fine and updated as i swipe them .
  But when I swipe to delete the last item , it comes back in the view . When i close the app and reopen the app , the item is deleted though .</p>
  
  <p>But when item is swiped to delete , in that instance of app running , the item is not deleted from view even after swiping multiple times .</p>
  
  <pre><code>@Override
  public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {
       int swipedPosition = viewHolder.getAdapterPosition();
       PlaceListAdapter adapter = (PlaceListAdapter) mRecyclerView.getAdapter();
  
       int pos = viewHolder.getAdapterPosition();
       // Build appropriate uri with String row id appended
       String stringId = places.get(pos).getId();
  
       Log.d("testhro", stringId);
  
       Uri uri = PlaceContract.PlaceEntry.CONTENT_URI;
       uri = uri.buildUpon().appendPath(stringId).build();
  
       Log.d("testhhd", uri.toString());
       // COMPLETED (2) Delete a single row of data using a ContentResolver
       getContentResolver().delete(uri, null, null);
       mAdapter.notifyDataSetChanged();
       refreshPlacesData();
  
  }
  </code></pre>
  
  <p><strong>refreshPlacesData()</strong></p>
  
  <pre><code> private void refreshPlacesData() {
          Uri uri = PlaceContract.PlaceEntry.CONTENT_URI;
          Cursor data = getContentResolver().query(
                  uri,
                  null,
                  null,
                  null,
                  null);
  
          if (data == null || data.getCount() == 0) return;
  
          Log.d("countIs", String.valueOf(data.getCount()));
  
          List&lt;String&gt; guids = new ArrayList&lt;String&gt;();
          while (data.moveToNext()) {
              guids.add(data.getString(data.getColumnIndex(PlaceContract.PlaceEntry.COLUMN_PLACE_ID)));
          }
          PendingResult&lt;PlaceBuffer&gt; placeResult = Places.GeoDataApi.getPlaceById(mClient,
                  guids.toArray(new String[guids.size()]));
          placeResult.setResultCallback(new ResultCallback&lt;PlaceBuffer&gt;() {
              @Override
              public void onResult(@NonNull PlaceBuffer places) {
                  mAdapter.swapPlaces(places);
                  MainActivity.this.places = places;
                  mGeofencing.updateGeofencesList(places);
                  if (mIsEnabled) mGeofencing.registerAllGeofences();
              }
          });
      }
  </code></pre>
  
  <p>Am I missing something? Thanks.</p>
  
  <p><strong>EDIT :</strong>
  i tried updating adapter instead of mAdapter , but still no change</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <pre><code>public void swapPlaces(PlaceBuffer newPlaces) {
          mPlaces = newPlaces;
          if (mPlaces != null) {
              // Force the RecyclerView to refresh
              this.notifyDataSetChanged();
  
          }
      }
  </code></pre>
  
  <p>Note : I also verified the loggers :</p>
  
  <p>D/countIsZero: true (inside refreshPlacesData())</p>