Requery
Since we already have an outstanding for the content provider’s contents, we call on that to update the ’s contents. This, in turn, will update any you may have wrapping the – and that will update any selection widgets (e.g., ) you have using the adapter.
To delete one or more rows from the content provider, use the method on . This works akin to a SQL statement and takes three parameters:
1. A representing the collection (or instance) you wish to update
2. A constraint statement, functioning like a SQL clause, to determine which rows should be updated
3. An optional set of parameters to bind into the constraint clause, replacing any ?s that appear there
Beware of the BLOB!
Binary large objects – BLOBs – are supported in many databases, including SQLite. However, the Android model is more aimed at supporting such hunks of data via their own separate content values. A content provider, therefore, does not provide direct access to binary data, like photos, via a . Rather, a property in the content provider will give you the content for that particular BLOB. You can use and on your to read and write the binary data.
Quite possibly, the rationale is to minimize unnecessary data copying. For example, the primary use of a photo in Android is to display it to the user. The widget can do just that, via a content to a JPEG. By storing the photo in a manner that has its own , you do not need to copy data out of the content provider into some temporary holding area just to be able to display it – just use the . The expectation, presumably, is that few Android applications will do much more than upload binary data and use widgets or built‑in activities to display that data.
Дата добавления: 2015-05-16; просмотров: 631;