Forive me for any ignorance, but I really need help on this one and have tried Vogella and many tutorials to no avail !
My content provider query:
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
final SQLiteDatabase db = mOpenHelper.getReadableDatabase();
final int match = sUriMatcher.match(uri);
switch (match) {
default: {
// Most cases are handled with simple SelectionBuilder
final SelectionBuilder builder = buildExpandedSelection(uri, match);
builder.where(selection, selectionArgs).query(db, projection, sortOrder);
builder.where(selection, selectionArgs).query(db, projection, sortOrder).setNotificationUri(getContext().getContentResolver(), uri);
return builder.where(selection, selectionArgs).query(db, projection, sortOrder);
}
}
}
Update Section of Provider:
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
LOGV(TAG, "update(uri=" + uri + ", values=" + values.toString() + ")");
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
final SelectionBuilder builder = buildSimpleSelection(uri);
int retVal = builder.where(selection, selectionArgs).update(db, values);
getContext().getContentResolver().notifyChange(uri, null);
return retVal;
}
Fragment Stuff: Which is being executed in list view on click method
ContentValues values = new ContentValues();
values.put(NewaysContract.News.READ,1);
getActivity().getContentResolver()
.update(CONTENT_URI,values,CONTENT+"=?",new String[] { contv });