Code example for ContentValues

Methods: putputNull

0
        byte[][] icons = { BookmarkUtils.getIcon(ICON_PATH), null };
        Uri uri = addBookmark(url[0], title[0], lastUpdateTime[0], createdTime[0], visits[0],
                icons[0], isBookmark[0]);
        assertNotNull(uri);
 
        ContentValues values = new ContentValues();
        values.put(BookmarkColumns.BOOKMARK, isBookmark[1]);
        values.put(BookmarkColumns.DATE, lastUpdateTime[1]);
        values.put(BookmarkColumns.URL, url[1]);
        values.putNull(BookmarkColumns.FAVICON);
        values.put(BookmarkColumns.TITLE, title[1]);
        values.put(BookmarkColumns.VISITS, visits[1]);
        String[] selectionArgs = { String.valueOf(lastUpdateTime[0]),
                String.valueOf(isBookmark[0]) };
        getContentResolver().update(uri, values, BookmarkColumns.FAVICON +  " IS NOT NULL AND " +
                BookmarkColumns.DATE + "= ? AND " + BookmarkColumns.BOOKMARK + " = ?",
                selectionArgs);
        Cursor cursor = getContentResolver().query(uri, null, null, null, null);
        assertEquals(1, cursor.getCount());
        assertTrue(cursor.moveToNext());
        int index = cursor.getColumnIndex(BookmarkColumns.BOOKMARK);