在实现ContentProvider时,文档中明确建议定义所有URI。但是我对URI匹配部分感到困惑:例如,我有一个名为“items”的表,包名为org.company.example
,然后我定义了
public static final Uri CONTENT_URI =
Uri.parse("content://org.company.example.sampleprovider/items");
在静态初始化中,我应该使用哪个权限部分来匹配URI:
private static final UriMatcher uriMatcher;
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("what goes here?", "items", ITEM);
uriMatcher.addURI("what goes here?", "items/#", ITEM_ID);
}