-
Notifications
You must be signed in to change notification settings - Fork 133
How to validate content values before insertion or update? #92
Copy link
Copy link
Open
Description
As we validate the content values in typical content provider before performing insertion or update like this example shown below,
private Uri insertMember(Uri uri, ContentValues values) {
if (values.size() == 0) {
return null;
}
String name = values.getAsString(MemberEntry.COLUMN_NAME);
if (!isValidName(name)) {
throw new IllegalArgumentException("Invalid Name");
}
SQLiteDatabase db = mDbHelper.getWritableDatabase();
long newRowId = db.insert(MemberEntry.TABLE_NAME, null, values);
if (newRowId == -1) {
Log.d(LOG_TAG, "Failed to insert row");
return null;
}
return ContentUris.withAppendedId(uri, newRowId);
}Similarly, how do we validate content values when using this library?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels