The implementation of the function is combined with many excellent implementations on the Internet. Let's look at the small optimization.
Implementation ideas:
1. Get the mobile phone contact list: query the contact list through URI uri = URI. parse ("content: // com. Android. Contacts/data/phones ").
2. There are many contac
This example describes how Android gets the avatar of a contact. Share to everyone for your reference, specific as follows:
Public byte[] Getphoto (string people_id) {
string photo_id = null;
String Selection1 = contactscontract.contacts._id + "=" + people_id;
Cursor cur1 = Getcontentresolver (). Query (
ContactsContract.Contacts.CONTENT_URI, NULL, selection1, NULL, NULL);
if (Cur1.getcount () > 0)
When you contact this tutorial, the method used to select a contact is to read the contact from the database, and then display it with listview. After selecting the contact, the mobile phone number is returned,
In this way, when you click to select a contact, it takes time t
A reference to the _id of the "raw contact", the rule applies to.
Raw_contact_id1
A reference to the other _id of the "raw contact", the rule applies to.
RAW_CONTACT_ID1 and Raw_contact_id2 are referenced by a rule (type)Sqlite_sequence tableAuto-numbered columns in SQLite
Name
The table where the AutoNumber field resides
Seq
The
Today's learning task: Read the main information (name and phone number) of all contacts on the mobile phone, and display it in listview
Main Content involved: 1) structure and usage of the contact API 2) role of the contentprovider component, Uri concept and usage 3) create a listview and bind data
1. Structure and usage of the contact API
Since Android
, conditional value string[] Array (contact_id)
Uri object is Uri.parse ("Content://com.android.contacts/data")
Loops are the same as above
The name corresponds to the type is Vnd.android.cursor.item/name
The corresponding type of telephone is VND.ANDROID.CURSOR.ITEM/PHONE_V2
Need permission, Android.permisssion.READ_CONTACTS
Invokes the Setadapter () method of the ListView object, assigning data to the view, and the parameter is a adapter object
Get adapter object with new Simpleadapter
contactnumber, @NonNull string contactname) {
Mtext.settext ( ContactName + contactnumber);
}
@Override public
void onfailed (@NonNull int errcode, @NonNull String message) {
Mtext.settext (errcode + message) ;
}
});
You need to have an anonymous inner class that will return Onsuccess and Onfailed methods, and then for contacts and phone numbers, you can do the relevant presentation.
Post-Encapsulation Summary
Call in one of your activity clas
The "Contact for Android acquisition System" above describes how to get the system contact and the actual combat, this article will explain how to add a contact informationAdd a Contact1. Add the Raw_contacts table and add a contact ID2. Manipulate the data table, insert the
Implement preset contacts (including names and numbers) to the mobile phone. Ensure that the contacts are read-only and cannot be deleted or edited.The code is divided into two parts:Part One inserts the preset contacts into the database;In Part Two mode, you cannot delete or edit a preset contact on the contact details and contact multi-choice interface.[Note] I
From: http://blog.csdn.net/baimy1985/article/details/7820024
There is a previous article about the information on the card (Android information (MMS) (7)-SIM card text message). There is also a very important information on the SIM card, that is, the contacts on the card. I don't know if you have noticed that Android phones, especially those with carrier IDs, are slow to boot. This is irrelevant to the co
Project Description: The project is based on the Android platform phone Address Book, the main module is divided into four parts: contact management module, call records Management module, SMS Management module, System Setup module. The system structure diagram is as follows: Project start Date: May 28, 2014 Note: All source code of this development project will be shared to everyone. The purpose of this p
/COM.ANDROID.PROVIDERS.CONTACTS/DATABASES/CONTACTS2.DB), which is a very complex table structure, There are more than 20 columns, including one named Sort_key, which is what we are looking for! As shown in the following illustration:
As you can see, this column is very humane to help us record the pinyin corresponding to the Chinese character, so that we can easily sort the contact by the value of this column.
Let's start with the implementation of
more and more Android apps are now using their mobile phone numbers to sign up and get their phone verification code to complete their registration. There are many applications to provide phone address Book backup function, get your permission to save your phone number in the address book to the server, you want to be down, for example, QQ, etc. have this function. So how do we get the phone number from the user's address book?
Android provides the "Contact" application, which is easy to use. It includes some common data type fields, such: contact name, phone number, Im address, email address, and so on. However, Android does not store the contact information as we think: open a table directly, and
This example describes the Android programming approach to contact. Share to everyone for your reference, specific as follows:
The contacts in the Android system also provide data externally via ContentProvider, where we implement to get all the contacts, get contacts by phone numbers, add contacts, and add contacts using transactions.
Get all Contacts
1. The
In the daily use of the Android phone, the phone number to get a contact avatar, is often encountered problems. This article is an example of how Android is getting contact with a phone number to get a head image of the implementation code. Share for everyone to use for reference. The specific methods are as follows:
As a mobile phone, the most important function is the phone number, text message, and contact. So today I want to share with you the API interface for Android phones, text messages, and contacts.
1. Call record acquisition
List
mRecords=new ArrayList
(); Cursor mCursor=mContext.getContentResolver().query(CallLog.Calls.CONTENT_URI, null,null, null,null); if(mCursor!=null mCursor.mo
When I use M1s, I feel that the last name of the contact in the prompt function is good. It is quite good to use. I made a simple function similar to this. The Code is as follows:
Package COM. FND. ui; import Java. util. arraylist; import Java. util. hashmap; import Java. util. list; import Java. util. map; import android. OS. bundle; import android. OS. handler;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.