Public query
New SQLiteQueryBuilder
SetTables getTableName
If isCollectionUri
SetProjectionMap getDefaultProjection
Else
AppendWhere getIdColumnName getPathSegments get
If isEmpty
GetDefaultSortOrder
Else
Query
Null null
SetNotificationUri getContext getContentResolver
Return
We create a and pour the query details into the builder. Note that the query could be based on either a collection or an instance – in the latter case, we need to add the instance ID to the query. When done, we use the method on the builder to get a for the results.
Insert()
Your method will receive a representing the collection and a structure with the initial data for the new instance. You are responsible for creating the new instance, filling in the supplied data, and returning a to the new instance.
If this is a SQLite‑backed content provider, once again, the implementation is mostly boilerplate: validate that all required values were supplied by the activity, merge your own notion of default values with the supplied data, and call on the database to actually create the instance.
For example, here is from :
Public insert
If null
New ContentValues
Else
New ContentValues
If isCollectionUri
Throw new IllegalArgumentException
For getRequiredColumns
Дата добавления: 2015-05-16; просмотров: 707;