Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Remove this use of "notifychange", it is deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
swetasarat2000 committed Oct 11, 2023
1 parent accc200 commit df8c1ff
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;

Expand Down Expand Up @@ -126,7 +127,9 @@ boolean onCreate(Context context) {
try {
db = databaseHelper.getWritableDatabase();
// Necessary to enable cascade deletion from Track to TrackPoints and Markers
db.setForeignKeyConstraintsEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
db.setForeignKeyConstraintsEnabled(true);
}
} catch (SQLiteException e) {
Log.e(TAG, "Unable to open database for writing.", e);
}
Expand All @@ -153,7 +156,7 @@ public int delete(@NonNull Uri url, String where, String[] selectionArgs) {
} finally {
db.endTransaction();
}
getContext().getContentResolver().notifyChange(url, null, false);
getContext().getContentResolver().notifyChange(url, null);

int totalChanges = getTotalChanges() - totalChangesBefore;
Log.i(TAG, "Deleted " + totalChanges + " total rows from database");
Expand Down Expand Up @@ -204,7 +207,7 @@ public Uri insert(@NonNull Uri url, ContentValues initialValues) {
} finally {
db.endTransaction();
}
getContext().getContentResolver().notifyChange(url, null, false);
getContext().getContentResolver().notifyChange(url, null);
return result;
}

Expand All @@ -227,7 +230,7 @@ public int bulkInsert(@NonNull Uri url, @NonNull ContentValues[] valuesBulk) {
} finally {
db.endTransaction();
}
getContext().getContentResolver().notifyChange(url, null, false);
getContext().getContentResolver().notifyChange(url, null);
return numInserted;
}

Expand Down Expand Up @@ -332,7 +335,7 @@ public int update(@NonNull Uri url, ContentValues values, String where, String[]
} finally {
db.endTransaction();
}
getContext().getContentResolver().notifyChange(url, null, false);
getContext().getContentResolver().notifyChange(url, null);
return count;
}

Expand Down

0 comments on commit df8c1ff

Please sign in to comment.