while (cursor.moveToNext()) { 4 String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts..._ID)); 5 String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME..., null, 16 ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId..., null, 27 ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + contactId,..., null, 34 ContactsContract.CommonDataKinds.StructuredPostal.CONTACT_ID + " = " +
com.example.contentprovider; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract...; import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.CommonDataKinds.Email...; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName...; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import...android.provider.ContactsContract.RawContacts; import android.app.Activity; import android.content.ContentResolver
_ID)); //取得联系人的显示名称 String name=cursor.getString(cursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME..., null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID+" = "+contactId,null,null); while(phone.moveToNext...()){ String phonum=phone.getString(phone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER...,null,ContactsContract.CommonDataKinds.Email.CONTACT_ID+" = "+contactId,null,null); while(email.moveToNext...()){ String mail=email.getString(email.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA
; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName...; import android.provider.ContactsContract.RawContacts; import android.provider.ContactsContract.RawContacts.Data...)); // 得到电话号码 String contactId = cur.getString(cur .getColumnIndex(ContactsContract.Contacts..., null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null, null..., values); // 往data表入电话数据 values.clear(); values.put(ContactsContract.Contacts.Data.RAW_CONTACT_ID
获取系统联系人信息的实例 一、获取手机联系人姓名及手机号 //跳转到系统联系人应用 Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI...cursor.moveToFirst(); // 获得联系人的ID号 int idFieldIndex = cursor .getColumnIndex(ContactsContract.Contacts...cursor.getString(idFieldIndex); // 联系人姓名 int idphoneNameIndex = cursor .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME..., null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=?"...allPhones.moveToNext()) { int telNoTypeIndex = allPhones .getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE
ContactsContract.Contacts.CONTENT_URI:联系人Uri。..., rawContactId); // 设置内容类型 values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE...values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);...values.put(ContactsContract.CommonDataKinds.Phone.NUMBER, phone); values.put(ContactsContract.CommonDataKinds.Phone.TYPE..., ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE); getContentResolver().insert(ContactsContract.Data.CONTENT_URI
cr = getContentResolver(); //取得电话本中开始一项的光标 Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI...//取得联系人名字 int nameFieldColumnIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME...//取得电话号码 String ContactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts..._ID)); Cursor phone = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI..., null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + ContactId, null, null);
中找到该联系人的电话号码 * 通过这个ID可以在ContactsContract.CommonDataKinds.Email.CONTENT_URI 找到该联系人的邮箱...中查询 * 条件为ContactsContract.CommonDataKinds.Phone.CONTACT_ID = 上面查询到的ID..., null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + contactId,...中查询 * 条件为ContactsContract.CommonDataKinds.Phone.CONTACT_ID = 上面查询到的ID..., null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + "=" + contactId,
; import android.provider.ContactsContract.CommonDataKinds.Event; import android.provider.ContactsContract.CommonDataKinds.Im...; import android.provider.ContactsContract.CommonDataKinds.Nickname; import android.provider.ContactsContract.CommonDataKinds.Note...; import android.provider.ContactsContract.CommonDataKinds.Organization; import android.provider.ContactsContract.CommonDataKinds.Phone...; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.CommonDataKinds.StructuredPostal...; import android.provider.ContactsContract.CommonDataKinds.Website; import android.provider.ContactsContract.Contacts
These are the Contacts rows that we will retrieve static final String[] PROJECTION = new String[] {ContactsContract.Data..._ID, ContactsContract.Data.DISPLAY_NAME}; // This is the select criteria static final String SELECTION...= "((" + ContactsContract.Data.DISPLAY_NAME + " NOTNULL) AND (" + ContactsContract.Data.DISPLAY_NAME...progressBar); // For the cursor adapter, specify which columns go into which views String[] fromColumns = {ContactsContract.Data.DISPLAY_NAME...will take care of // creating a Cursor for the data being displayed. return new CursorLoader(this, ContactsContract.Data.CONTENT_URI
mobile_number); values.put(Phone.TYPE, Phone.TYPE_MOBILE); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI...Email.DATA, email); values.put(Email.TYPE, Email.TYPE_WORK); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI...values.put(Im.DATA, qq); values.put(Im.PROTOCOL, Im.PROTOCOL_QQ); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI..., Note.CONTENT_ITEM_TYPE); values.put(Note.NOTE, describe); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI...Photo.CONTENT_ITEM_TYPE); values.put(Photo.PHOTO, avatar); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI
hasPermission) { return contacts; } var uri = ContactsContract.Contacts.ContentUri;..., ContactsContract.Contacts.InterfaceConsts.DisplayName,...ContactsContract.Contacts.InterfaceConsts.PhotoThumbnailUri }, null, null, $"{ContactsContract.Contacts.InterfaceConsts.DisplayName..., null, ContactsContract.CommonDataKinds.Phone.InterfaceConsts.ContactId + " = ?"..., null, ContactsContract.CommonDataKinds.Email.InterfaceConsts.ContactId + " = ?"
import java.util.Map; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract...; import android.provider.ContactsContract.PhoneLookup; import android.app.Activity; import android.content.ContentResolver...nameFieldColumnIndex); //name += (name); // 取得联系人ID String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts..._ID)); Cursor phone = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID...while (phone.moveToNext()) { String strPhoneNumber = phone.getString(phone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER
android.os.Bundle; import android.os.Handler; import android.os.Message; import android.provider.ContactsContract...MyAsyncQueryHandler(getContentResolver()); initSQL(); } }); } protected void initSQL() { // 联系人URI Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI...; // 联系人ID,联系人NAME, String[] projection = { ContactsContract.CommonDataKinds.Phone...._ID, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.DATA1..., "sort_key", ContactsContract.CommonDataKinds.Phone.CONTACT_ID, }; asyncQuery.startQuery(0, null,
; import android.content.pm.PackageManager; import android.database.Cursor; import android.provider.ContactsContract...readContacts() { Cursor cursor = null; try{ cursor = getContentResolver().query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI...//获取联系人姓名 String displayName = cursor.getString(cursor.getColumnIndex( ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME...)); //获取联系人手机号 String number = cursor.getString(cursor.getColumnIndex( ContactsContract.CommonDataKinds.Phone.NUMBER
projection = new String[] {Phone.DISPLAY_NAME, Phone.NUMBER}; Uri uri_Person = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI...android.database.sqlite.SQLiteException; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract...; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.util.Log; import android.widget.ScrollView...projection = new String[] {Phone.DISPLAY_NAME, Phone.NUMBER}; Uri uri_Person = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI
Uri uri= ContactsContract.Contacts.CONTENT_URI; Cursor cs=getContentResolver().query(uri, null, null...()){ int uid=cs.getInt(cs.getColumnIndex(ContactsContract.Contacts....Uri uri= new Uri(ContactsContract.Contacts.CONTENT_URI); Cursor cs=getContentResolver().query(uri);...while(cs.moveToNext()){ int uid=cs.getInt(ContactsContract.Contacts...._ID)); String name=cs.getString(ContactsContract.Contacts.DISPLAY_NAME)); Log.d("mylog",""+uid+
android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.provider.ContactsContract...; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.widget.ListView; import...list = new ArrayList>(); Cursor cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI
// 数据查询 try (Cursor cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI...)); String number = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER...联合使用,用于替换selection中的 sortOrder:排列顺序,相当于数据库中的order by 全部参数使用实例: contentResolver.query(android.provider.ContactsContract.Contacts.CONTENT_URI..., new String[]{android.provider.ContactsContract.Contacts.DISPLAY_NAME} , android.provider.ContactsContract.Contacts.DISPLAY_NAME..., new String[]{"小易"} , android.provider.ContactsContract.Contacts.DISPLAY_NAME + " DESC"); // 中间存在空格
LocationManager.requestLocationUpdates - 读/发 短信 SmsManager.sendTextMessage SmsMessage.createFromPdu - 读写联系人 ContactsContract.Contacts...ContactsContract.RawContacts ContactsContract.Data - 读取应用列表(读取手机中已安装应用的列表) PackageManger.getInstalledApplications
领取专属 10元无门槛券
手把手带您无忧上云