Code example for ContentValues

Methods: insert

        grantUriPermission(sub2Uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION, true);
        // See if we now have access to the provider. 
        getContext().getContentResolver().insert(sub2Uri, new ContentValues());
        // And still to the previous URI. 
        getContext().getContentResolver().insert(subUri, new ContentValues());
        // But not reading. 
        assertReadingContentUriNotAllowed(sub2Uri, "shouldn't read from granted write");
        // And not to the base path. 
        assertWritingContentUriNotAllowed(uri, "shouldn't write non-granted base URI");
        // And not a sub-path. 
        assertWritingContentUriNotAllowed(sub2SubUri, "shouldn't write non-granted sub URI");
        if (false) { 
Experience pair programming with AI  Get Codota for Java