Cursor cursor = context.getContentResolver().query(Sms.CONTENT_URI,         new String[]{"thread_id from sms where type = 3 group by thread_id-"},  // 可以这样使用.         null, null, null); 07-17 10:55:17.084: E/AndroidRuntime(30157): FATAL EXCEPTIO…
注:本片整理自 http://blog.csdn.net/wssiqi/article/details/8132603 1.获取联系人姓名 一个简单的例子,这个函数获取设备上所有的联系人ID和联系人NAME. public void fetchAllContacts() { ContentResolver contentResolver = this.getContentResolver(); Cursor cursor = contentResolver.query(android.provi…
此博文转载自:http://blog.csdn.net/wssiqi/article/details/8132603 1.获取联系人姓名 一个简单的例子,这个函数获取设备上所有的联系人ID和联系人NAME. public void fetchAllContacts() { ContentResolver contentResolver = this.getContentResolver(); Cursor cursor = contentResolver.query(android.provid…
Retrieving Data from the Provider This section describes how to retrieve data from a provider, using the User Dictionary Provider as an example. For the sake of clarity, the code snippets in this section call ContentResolver.query() on the "UI thread…
import java.util.ArrayList;import java.util.HashMap;import java.util.Map; import android.os.Bundle;import android.provider.UserDictionary.Words;import android.app.Activity;import android.content.ContentResolver;import android.content.ContentValues;im…
这篇文章被转载而转载者未注明原文出处,在此未加上原文地址链接,本人向原作者致以歉意. 下面是文章内容: 使用ContentProvider共享数据: 当应用继承ContentProvider类,并重写该类用于提供数据和存储数据的方法,就可以向其他应用共享其数据.虽然使用其他方法也可以对外共享数据,但数据访问方式会因数据存储的方式而不同,如:采用文件方式对外共享数据,需要进行文件操作读写数据:采用sharedpreferences共享数据,需要使用sharedpreferences API读写数据…
我们都知道在Android系统中,SQLite数据库的相关操作方式被封装为内容提供Content Provider,可以帮助那些不会SQL语言的开发者快速实现Android平台上的数据库操作,但是平时我们在查询时一般返回的是Cursor对象,从本质上来看这两个API是不同的类提供的.Android123提示比如 ContentResolver.query(),以及Activity.managedQuery()所以,我们看到一个是ContentResolver提供的查询方法,位于android.c…
例如以下内容为从网络转载: 使用ContentProvider共享数据: 当应用继承ContentProvider类,并重写该类用于提供数据和存储数据的方法,就能够向其它应用共享其数据.虽然使用其它方法也能够对外共享数据,但数据訪问方式会因数据存储的方式而不同,如:採用文件方式对外共享数据,须要进行文件操作读写数据:採用sharedpreferences共享数据,须要使用sharedpreferences API读写数据.而使用ContentProvider共享数据的优点是统一了数据訪问方式.…
惭愧,现在才接触到ContentResolver的用法 这个类主要是Android用来实现应用程序之间数据共享的 一个应用程序可以将自己的数据完全暴露出去,外界更本看不到,也不用看到这个应用程序暴露的数据是如何存储的,或者是使用数据库还是使用文件,还是通过网上获得,这些一切都不重要,重要的是外界可以通过这一套标准及统一的接口和这个程序里的数据打交道,例如:添加(insert).删除(delete).查询(query).修改(update),当然需要一定的权限才可以. 一个程序可以通过实现一个Co…
转载自:http://www.jb51.net/article/106379.htm 首先需要在AndroidManifest.xml文件中添加权限: <uses-permission android:name="android.permission.READ_CONTACTS" /> activity_main.xml布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/an…