@Override
  public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    SQLiteDatabase db = dbHelper.getWritableDatabase();
    int rowUpdated = 0;
    switch (sUriMatcher.match(uri)) {
      case 1:
        rowUpdated =
            db.update(
                SmartKidContract.HomeSameCityList.TABLE_NAME, values, selection, selectionArgs);
        break;

      case 2:
        String id = uri.getLastPathSegment();
        if (TextUtils.isEmpty(selection)) {
          rowUpdated =
              db.update(
                  SmartKidContract.HomeSameCityList.TABLE_NAME,
                  values,
                  SmartKidContract.HomeSameCityList.ROW_ID + " = " + id,
                  null);
        } else {
          rowUpdated =
              db.update(
                  SmartKidContract.HomeSameCityList.TABLE_NAME,
                  values,
                  SmartKidContract.HomeSameCityList.ROW_ID + " = " + id + " and " + selection,
                  null);
        }
        break;
    }
    getContext().getContentResolver().notifyChange(uri, null);
    return rowUpdated;
  }
 @Override
 public Uri insert(Uri uri, ContentValues values) {
   SQLiteDatabase db = dbHelper.getWritableDatabase();
   switch (sUriMatcher.match(uri)) {
     case 1:
       long id = db.insert(SmartKidContract.HomeSameCityList.TABLE_NAME, null, values);
       if (-1 != id) {
         getContext().getContentResolver().notifyChange(uri, null);
         return Uri.withAppendedPath(uri, Long.toString(id));
       } else {
         throw new SQLiteException("Insert error:" + uri);
       }
   }
   return null;
 }
  @Override
  public Cursor query(
      Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    SQLiteDatabase db = dbHelper.getWritableDatabase();
    SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    queryBuilder.setTables(SmartKidContract.HomeSameCityList.TABLE_NAME);
    switch (sUriMatcher.match(uri)) {
      case 1:
        break;

      case 2:
        queryBuilder.appendWhere(
            SmartKidContract.HomeSameCityList.ROW_ID + " = " + uri.getLastPathSegment());
        break;
    }

    Cursor cursor =
        queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
    cursor.setNotificationUri(getContext().getContentResolver(), uri);
    return cursor;
  }