/***
* AndroidManifest.xml
*
<uses-permission android:name="android.permission.READ_CONTACTS"/>
/***
* AutoMultipleContacts.java
*
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Contacts;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.Filterable;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;
public class AutoMultipleContacts extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.multipleselect);
Cursor peopleCursor = getContentResolver().query(Contacts.People.CONTENT_URI, PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
ContactListAdapter contactadapter = new ContactListAdapter(this,peopleCursor);
MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.contacts);
textView.setAdapter(contactadapter);
textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
public static class ContactListAdapter extends CursorAdapter implements Filterable {
public ContactListAdapter(Context context, Cursor c) {
super(context, c);
mContent = context.getContentResolver();
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
final LayoutInflater inflater = LayoutInflater.from(context);
final TextView view = (TextView) inflater.inflate(
android.R.layout.simple_dropdown_item_1line, parent, false);
view.setText(cursor.getString(5));
return view;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
((TextView) view).setText(cursor.getString(5));
}
@Override
public String convertToString(Cursor cursor) {
return cursor.getString(5);
}
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
if (getFilterQueryProvider() != null) {
return getFilterQueryProvider().runQuery(constraint);
}
StringBuilder buffer = null;
String[] args = null;
if (constraint != null) {
buffer = new StringBuilder();
buffer.append("UPPER(");
buffer.append(Contacts.ContactMethods.NAME);
buffer.append(") GLOB ?");
args = new String[] { constraint.toString().toUpperCase() + "*" };
}
return mContent.query(Contacts.People.CONTENT_URI, PEOPLE_PROJECTION,
buffer == null ? null : buffer.toString(), args,
Contacts.People.DEFAULT_SORT_ORDER);
}
private ContentResolver mContent;
}
private static final String[] PEOPLE_PROJECTION = new String[] {
Contacts.People._ID,
Contacts.People.PRIMARY_PHONE_ID,
Contacts.People.TYPE,
Contacts.People.NUMBER,
Contacts.People.LABEL,
Contacts.People.NAME,
};
}
/***
* res/layout/multipleselect.xml
*
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<MultiAutoCompleteTextView
android:id="@+id/contacts"
android:textSize="18sp"
android:layout_margin="8px"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
47 Comments
When we got out of the car at our house, the three children ran through the front door and straight to the toys that were spread out under our Christmas tree. One of the girls spied Jill’s doll and immediately hugged it to her breast. I remember that the little boy grabbed Sharon’s ball. And the other girl picked up something of mine. All this happened a long time ago, but the memory of it remains clear. That was the Christmas when my sisters and I learned the joy of making others happy.
Thank you for introducing me the useful information.And .....Totally boring. can you tell me where is the red and gold colors...? I predict a very low seller....I look forward your answer.thank you!
I like this article about<b><a http://www.adidasvipshop.com
Welcome to check on our
website!Any needs or any orther questions, welcome to contact us at any time ! Shopping online offers lots of benefits
that you won't find shopping in a store or by mail. The Internet is always open — seven days a week, 24 hours a
day — and bargainscan be numerous online.With a click of a mouse, you can buy an airline ticket, book a hotel,
send flowers to a friend .
Welcome to check on our
website!Any needs or any orther questions, welcome to contact us at any time ! Shopping online offers lots of benefits
that you won't find shopping in a store or by mail. The Internet is always open — seven days a week, 24 hours a
day — and bargainscan be numerous online.With a click of a mouse, you can buy an airline ticket, book a hotel,
send flowers to a friend .
I want to thank you from the core of my heart for doing such a research. Just now I completed reading your post and also find the tips to be useful. I will surely try to keep all those points in mind.
Thanks for doing such a thorough research work. I must say all the tips you have mentioned here are useful. So, I have saved the page. Hope it will help me in my future endeavors.
I want to thank you from the core of my heart for doing such a research. Just now I completed reading your post and also find the tips to be useful. I will surely try to keep all those points in mind.
Thanks for your sharing, good job!
I was trying to do the same thing but I am doing the current version of android.provider.ContactsContract;
The following is my code for the projection:
private static final String[] PEOPLE_PROJECTION = new String[] {
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME
};
1. How can you add the phone number here?
2. Currently, the name of my contacts is the one displaying on the AutoCompleteTextView. That is ok. But in your code, how to get the ContactsContract.Contacts._ID outside of ContactsAutoCompleteCursorAdapter
I would appreciate of any help on this. I am currently struggling on this.
Such a good article, caught my sympathy!
Nice post!I agree with you!
adidas shoes More than 60 years after a feud between brothers adidas outlet and Rudolf Dassler resulted in the creation of the adidas men's shoes and Puma sportswear rivalry, the two companies are making peace cheap adidas shoes for one day. adidas originals pros are its very stylish, adidas running shoes feels great on your feet and clothing wise, cheap adidas shoes are very reasonably priced from adidasbuy com. adidas shoes sale are very comfortable, light weight, stylish and great value for money. The adidas superstar soles are designed really well and give you great grip across all terrains. Here we feature a pair of adidas stan smith and and Oregon Ultra LE, which are part of the Originals Jacket NBA Highlights Collection. adidas running shoes are now available at select adidas zx 500 retailers. The original content are from Kicks on Fire and adidas sneakers really was an eye candy for the adidas zx 8000 fans. They didn’t know Originals T-Shirt have cool designs like this. They will begin hitting select adidas f50 adizero in August.
adidas shoes More than 60 years after a feud between brothers adidas outlet and Rudolf Dassler resulted in the creation of the adidas men's shoes and Puma sportswear rivalry, the two companies are making peace cheap adidas shoes for one day. adidas originals pros are its very stylish, adidas running shoes feels great on your feet and clothing wise, cheap adidas shoes are very reasonably priced from adidasbuy com. adidas shoes sale are very comfortable, light weight, stylish and great value for money. The adidas superstar soles are designed really well and give you great grip across all terrains. Here we feature a pair of adidas stan smith and and Oregon Ultra LE, which are part of the Originals Jacket NBA Highlights Collection. adidas running shoes are now available at select adidas zx 500 retailers. The original content are from Kicks on Fire and adidas sneakers really was an eye candy for the adidas zx 8000 fans. They didn’t know Originals T-Shirt have cool designs like this. They will begin hitting select adidas f50 adizero in August.
Keep writing, continue to inspire, to keep creating
I am searching this very long time...
http://www.mbtsandal.com
Hhe let-nostalgic article's content rich variety which make us move for our mood after reading
this article.
good post thank you
Thank you for your sharing.
It was a very nice idea!
wow,good
I have a look at your article and learn frome some usefule information.
Thank you for taking the time to write this blog post.
http://www.supramenshoes.com/ supra footwear
http://www.af1dunksb.com/ air force 1
http://www.asicskicsk.com/ Asics Onitsuka Tiger
http://wendysreplica.com
That is great!
<a href=http://www.topchanelbag.com>chanel</a>
<a href=http://www.topguccibags.com>gucci</a>
<a href=http://www.greathermes.com>hermes</a>
<a href=http://www.greatlouisvuitton.com>louis vuitton</a>
<a href=http://www.topdesignerhandbag.com>designer handbags</a>
<a href=http://www.replicacell.com>vertu phones</a>
<a href=http://wendysreplica.com/blog>designer handbags reviews</a>
<a href=http://wendysreplica.com>wendy's replica</a>
<a href=http://www.replicacell.com>replica phones</a>
<a href=http://www.replicacell.com/vertu-replica.html>vertu replica</a>
<a href=http://www.replicacell.com/tag-heuer-phone.html>tag heuer phone</a>
<a href=http://www.replicacell.com/mobiado.html>mobiado</a>
<a href=http://www.replicacell.com/cartier-phones.html>cartier-phones</a>
<a href=http://www.replicacell.com/goldvish.html>goldvish</a>
<a href=http://www.replicacell.com/rolex-mobile.html>rolex mobile</a>
<a href=http://www.replicacell.com/porsche-phone.html>porsche phone</a>
<a href=http://www.replicacell.com/replica-blackberry.html>replica blackberry</a>
<a href=http://www.replicacell.com/iphone-replica.html>iphone replica</a>
<a href=http://www.topchanelbag.com>chanel</a>
<a href=http://www.topguccibags.com>gucci</a>
<a href=http://www.greathermes.com>hermes</a>
<a href=http://www.greatlouisvuitton.com>louis vuitton</a>
<a href=http://www.topdesignerhandbag.com>designer handbags</a>
<a href=http://www.replicacell.com>vertu phones</a>
<a href=http://wendysreplica.com/blog>designer handbags reviews</a>
<a href=http://wendysreplica.com>wendy's replica</a>
<a href=http://www.replicacell.com>replica phones</a>
<a href=http://www.replicacell.com/vertu-replica.html>vertu replica</a>
<a href=http://www.replicacell.com/tag-heuer-phone.html>tag heuer phone</a>
<a href=http://www.replicacell.com/mobiado.html>mobiado</a>
<a href=http://www.replicacell.com/cartier-phones.html>cartier-phones</a>
<a href=http://www.replicacell.com/goldvish.html>goldvish</a>
<a href=http://www.replicacell.com/rolex-mobile.html>rolex mobile</a>
<a href=http://www.replicacell.com/porsche-phone.html>porsche phone</a>
<a href=http://www.replicacell.com/replica-blackberry.html>replica blackberry</a>
<a href=http://www.replicacell.com/iphone-replica.html>iphone replica</a>
Enjoyed every bit of your blog.Thanks Again. Great.
I am always searching online for articles that can help me get further ahead. Thanks a million!
Thanks for this! I’ve been looking all over the internet for it.
Great thanks for sharing this article post.
I hope you don't mind me linking you so that this information spreads more.
Brilliantly put.
I need to retweet this to my twitter.
These are gorgeous, thank you for sharing them. good luck with the show! cool :)
Oh man, thank you for writing this.
Excellent piece.
Thank you for sharing such good experience.I also like to write such things in own blog. http://www.clothingseries.com cheap gucci mens shirts are very good!
I hope you will keep updating your content constantly as you have one dedicated reader here.
Sell 2010 new arrival shoes
We supply all kinds of moncler boots,moncler bags,moncler coats,moncler jackets,moncler T-shirt,moncler vest and so on.We have got a good reputation pf our products with top quality and good price.We sincerely look forward to futher cooperation with you for mutual benefits.We are sure that you will find working with us is a pleasant, time-saving and profitable experience.
Good post!Cheap nfl jerseys on sale!
welcome to come here to see the kinds of asics shoes, so you can buy tese cheap asics shoes online.hope you have a shopping here.
<a href="http://www.asics-shoes.biz">asics shoes</a>
<a href="http://www.asics-shoes.biz">asics running shoes</a>
<a href="http://www.asics-shoes.biz">asics gel</a>
<a href="http://www.asics-shoes.biz">onitsuka tiger</a>
<a href="http://www.asics-shoes.biz">asics onitsuka tiger</a>
<a href="http://www.asics-shoes.biz">asics tiger</a>
<a href="http://www.asics-shoes.biz">asics gt</a>
<a href="http://www.asics-shoes.biz">asics womens</a>
welcome to come here to see the kinds of asics shoes, so you can buy tese cheap asics shoes online.hope you have a shopping here.
<a href="http://www.asics-shoes.biz">asics shoes</a>
<a href="http://www.asics-shoes.biz">asics running shoes</a>
<a href="http://www.asics-shoes.biz">asics gel</a>
Add a Comment
There are various kinds of ghd hair straighteners on hot sell. GHD styler specialized in ghd australia market and provides many cheap ghd, ghd iv styler, pink ghd, purple ghd, which save up to 50%, with free shipping!
Add a Comment