content provider return data table, note that the unique identification _id is usually required to read, otherwise it is easy to errorContactsContract.Contacts.DISPLAY_NAME,ContactsContract.Contacts.HAS_PHONE_NUMBER};protected void OnCreate (Bundle savedinstancestate) {Super.oncreate (savedinstancestate);Cursor Contactcursor =Managedquery (ContactsContract.Contacts.CONTENT_URI,INFO, Null,null,null);ListAdapter adapter = new Simplecursoradapter (This,
How to obtain android mobile phone contacts and display them in letters (2): android contacts
The following describes how to categorize and display contacts with the same initials:
In the adapter implement SectionIndexer
In this w
account name of a Google account is one of the device owner's Gmail ses SSEs. see the next entryAccount_typeForMore information.
The format of this name is specific to its account type. It is not necessarily an email address.
Account_type
The Account type that's the source of this raw contact. For example, the Account type of a Google account isCom. Google. Always qualify your account type with a domain identifier for a domain you own orControl. This will ensure that your account
table:RAW_CONTACT_ID: The relative data in the Raw_contact table can be found by raw_contact_id.Data1 to data15 here to keep contact information contact name Contact Phone Number Email comments etc
Raw_contacts table:Version: edition number, for monitoring changesDeleted: Delete flag, 0 is default 1 means this row of data has been deletedDisplay_name: Contact NameLast_time_contacts: The Last contact time
"Description: Because these tables are very many fields, screenshots are not complete, yo
First, create a layout file. The interface is very simple. It is a search box and the following contact list:
Copy codeThe Code is as follows: Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: background = "# FFD3D7DF"
Android: orientation = "vertical"
Android applications are often used to develop Android mobile phone contacts. In Android, listview is usually used to present mobile phone contacts. If you want to achieve full selection using checkbox, the default listview does not seem to solve this problem.
In the follo
[Android] mobile guard reads contacts, android guard
Obtains the ContentResolver content parser object through the getContentResolver () method.
Call the query () method of the ContentResolver object to obtain the data in the raw_contacts table and obtain the Cursor object.
Parameter: Uri object, field String Array
Obtain the Uri object by using the Uri. parse (
The examples in this article describe common adapters and custom adapter usage in Android programming. Share to everyone for your reference, specific as follows:
One, adapter.
As the name suggests, is to make some data appropriate, suitable for easy to display on the view. Can be seen as an understanding of interface data binding. The data that it manipulates i
sectionindexer. However, it is too troublesome to write another sectionindexer. Here, we directly use the Android-provided alphabetindexer implementation, it is sufficient to use it to implement the Contact Group function.
The alphabetindexer constructor requires three parameters. The first parameter is cursor, the second parameter is sortedcolumnindex, and the third parameter is the alphabet string. The cursor transmits the cursor we found from the
First build the layout file, the interface is very simple, is a search box and the following contact list:
Copy Code code as follows:
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
Android:background= "#FFD3D7DF"
android:orientation= "Vertical"
android:padding= "0dip" >
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:layout_marginleft= "3dip"
android:layout_marginright= "3dip"
android:layout_margintop= "3dip" >
layout is hidden.The complete mainactivity code is as follows:
Public class mainactivity extends activity {/*** group Layout */private linearlayout titlelayout;/*** pop-up group Layout */private relativelayout sectiontoastlayout; /** sliding alphabet */private button alphabetbutton on the right side;/* The letter displayed on the Group */private textview title; /*** text in the pop-up group */private textview sectiontoasttext;/*** contact listview */private listview contactslistview;/*** contac
Our phone Address book generally has this effect, such as:OK, this effect everyone has seen more, basically all of the Android phone address book has this effect. So let's see how this works out today.I. Overview 1. Page function analysisOn the whole, the left is a ListView, the right is a custom view, but the left side of the ListView is a little bit different from the one we normally use, that is, in the ListView I grouped all the
Android 2.0 and later versions have made significant changes to contacts and other related APIs. Therefore, it is not recommended to port operations on Android 1.6 to Android 2.0. Here is a simple description of the operation method in SDK1.6.Do not forgetAndroidManifest. xmlAdd the permission to read
I changed my new mobile phone a few days ago. After a while, I found that the contacts imported to my Google account could not be searched, either in pinyin or Chinese characters. No contacts were found in Google search. After searching online, I found the following solution:
Delete a Google account
Restart
Re-import Google account
The Google account has not been deleted, in my previous article "
Android note 11. ListView + AdapterUnderstanding Adapter 1. ListViewListView is a common component in Android development. It displays data in the form of a list. Generally, a ListView consists of the following three elements:1. View: Displays the list view, which is usually specified by an xml file. As we all know, the Andro
How to get android mobile phone contacts and display them in letters (2)
The following describes how to categorize and display contacts with the same initials:
In the adapter implement SectionIndexer
In this way, the adapter must implement the following three interfaces:
@
information to cursor. This is a table structure. Each contact has multiple details.Cursorloader = new cursorloader (getapplicationcontext (),Contactscontract. Contacts. content_uri,Null, null, null, contactscontract. Contacts. display_name + "ASC ");Cursor c = cursorloader. loadinbackground ();
// In this example, we only need to display the displayname in the contact to the textview control in the subvie
use background data, you just simply tick the background data only.
Under the background data and auto sync option, you can set the synchronization settings for each account owned (if you have multiple accounts ). to do this, select one of the account belongs to you, if you want to enable synchronization, give tick markOn "sync contacts", "
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.