2013年12月16日
摘要: 1. select SELECT LastName,FirstName FROM Persons; SELECT * FROM Persons;2. where SELECT * FROM Persons WHERE City='Beijing'; SELECT * FROM Persons WHERE FirstName='Thomas' AND LastName='Carter' SELECT * FROM Persons WHERE (FirstName='Thomas' OR FirstName='William& 阅读全文
posted @ 2013-12-16 18:41 wlrhnh 阅读(1380) 评论(0) 推荐(0) 编辑
摘要: 前面一片文章中用到了ContentProviderOperation,那么我们就来看看ContentProviderOperation到底是怎么工作的。1.ContentProviderOperation实现了Parcelable,构造器是私有的,因此不能直接创建该对象,代码如下: 1 public class ContentProviderOperation implements Parcelable { 2 /** @hide exposed for unit tests */ 3 public final static int TYPE_INSERT = 1; 4 ... 阅读全文
posted @ 2013-12-16 18:38 wlrhnh 阅读(2688) 评论(0) 推荐(0) 编辑
摘要: Android添加联系人有两种方式:1. 直接调用插入语句,先插入一个空Item,得到一个id,然后给这个id对应的插入其他信息,如姓名,号码,邮件等;2. 利用ContentProviderOperation, 在系统应用Phonebook中就是采用这种方式, 代码如下:实现了插入姓名,号码以及头像。 1 private boolean saveUpdatedPhoto(long rawContactId, File photoFile) { 2 final Uri outputUri = Uri.withAppendedPath(ContentUris.with... 阅读全文
posted @ 2013-12-16 18:15 wlrhnh 阅读(2204) 评论(1) 推荐(0) 编辑