[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 (
Android Address Book fuzzy search (numbers, names, initials, full spelling), batch select contactsAndroid Address Book fuzzy search (numbers, names, initials, full spelling), batch select contacts
The company encountered a requirement in a recent project that needed to read contacts in the address book and support fuzzy queries and batch selection of
. widget. arrayadapter;
Import
Android. widget. listview; Public Class Main Extends Listactivity { /** Called when the activity is first created. */ @ Override Public Void Oncreate (bundle savedinstancestate ){ Super . Oncreate (savedinstancestate );Uri contactsuri = Contactscontract. Contacts. content_uri;String [] proj1 = New String [] {
If (data. equals (AbstractStartSIMService. defaultNumbers [I]) | data. equals (AbstractStartSIMService. defaultNames [I]) {Count ++;}}If (count! = 0 ){AddEditAndDelete = false;}}}} 3. Modify the EditContactActivity. java and EditSimContactActivity. java files to prevent users from inserting contacts with the same name and number as the preset number.(1) modify the EditContactActivity. java FileA. At the beginning of the file,
Use of Android open-source class library Pinyin4j ---- search contacts
Pinyin4j can only be regarded as a Java open source class library, but it is also frequently used in Android application development. You have used mobile phone address book and address book to search for contacts. You can use pinyin4j. The followin
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"
source code directory
A. Compile the SDK
# Make product-SDK
After the SDK is compiled, in the out/host/linux-x86/SDK/android-sdk_eng.xxx_linux-x86, pay attention to remove it, it is better to clear it next time Mmm Compilation
B. Compile the application module: less contact
. Build/envsetup. Sh
Mmm packages/apps/contacts
$ Make Snod
Regenerate system. IMG and run the simulator: emulator
Next, the android content provider-content providers (1)
Contacts provider is a powerful and flexible component in Android. It manages the data in the system address book and provides external access interfaces to access and operate the system address book.
The organization chart of contacts provider is as follows:
It
In many cases, we have to use the operations of selecting contacts. It is very troublesome to write it by ourselves. Instead, it is better to directly call the system's address book.
Let's look at the requirements below:
Requirements:When an edittext button is clicked, go to the system address book. Select one address book item and return it to the current interface.The username of the selected contact number is displayed on edittext.
PINYIN4J is only a Java open source class library, but it is often used in Android application development. Everyone has used the phone's address book, contacts of the search contact function, with pinyin4j can be achieved. Here I give you this example, using pinyin4j to implement the search contact function.First, a simple introduction to pinyin4j:Pinyin4j is a popular Java library, supporting the conversi
Next, go to the android content providers (II) -- contacts provider to continue. Next, we will describe the top-level contacts, the contacts is the aggregate contact table, and the rawcontacts discussed earlier is the original contact table, in the architecture of the android
the contacts in the Android system are also available through ContentProvider, where we get all the contacts, get contacts by phone number, add contacts, add contacts using transactions. Get all
With this article, I would like to explain how to create a searchable "contact list" Android application. With this application, users can browse through all saved contacts and search for contacts by their contact names by using the navigation buttons. The application can also display a photo of the contact, if available.
To browse the contact list, you can use
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 h
know the hostname and path . Follow me to look at the source code, this time the contact app content provider's path is android4.4\packages\providers\contactsprovider . To open the manifest file, you can see the following information: provider android:name = "ContactsProvider2" android:authorities =" contacts;com.android.contacts " Span class= "Hljs-attribute" >android:label = "@string/provider_label" android:multiprocess = "false" andro
Android quick index (City list and contacts) and android Index
You need to quickly index a city list. Similar to a contact application, the quick indexing function is based on the first letter of the name.To implement this function, you only need to solve two problems:
1. Grouping the list (having the same feature) and quickly locating the first item in the grou
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" >
In the Peopleactivity interface, the contact's display position is determined by the first character of its display name.The contacts at the beginning of the number are displayed under the "#" header.The Chinese and English contacts will appear under "A" to "Z".Contacts that begin with a symbol do not have a corresponding header, which is displayed at the top, an
In the Peopleactivity interface. The display location of the contact is determined by the first character of its display name.The contacts at the beginning of the number are displayed under the "#" header.The Chinese and English contacts will appear under "A" to "Z".Contacts that begin with a symbol do not have a corresponding header. is displayed at the top of t
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.