【发布时间】:2010-12-19 00:28:03
【问题描述】:
在 android Notes 演示中,它接受 URI:
sUriMatcher.addURI(NotePad.AUTHORITY, "notes", NOTES);
sUriMatcher.addURI(NotePad.AUTHORITY, "notes/#", NOTE_ID);
notes 和 notes/# 的区别在于 notes/# 返回 ID 与 # 匹配的便笺。
但是,用于从内容提供者获取数据的 managedQuery() 方法具有以下参数:
Parameters
uri The URI of the content provider to query.
projection List of columns to return.
selection SQL WHERE clause.
selectionArgs The arguments to selection, if any ?s are pesent
sortOrder SQL ORDER BY clause.
那么,设计决定是否为此提供 URI,而不仅仅是使用选择参数?还是只是口味问题?
谢谢。
【问题讨论】:
-
你能链接到演示吗?我从没见过。
-
给你:developer.android.com/resources/samples/NotePad/index.html,它在notepadproviderclass中(在src目录下,后面跟着一堆子目录)。