I have removed the deprecated class variables and methods. Also replaced them with the new classes. Check the code below and let me know if it solves your problem.
import android.provider.ContactsContract.CommonDataKinds;
public class AutoMultipleContacts extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Cursor peopleCursor = getContentResolver().query(CommonDataKinds.Phone.CONTENT_URI,
PEOPLE_PROJECTION, null, null, CommonDataKinds.Phone.CONTACT_ID);
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)+"<"+cursor.getString(3)+">");
return view;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
((TextView) view).setText(cursor.getString(5)+"<"+cursor.getString(3)+">");
}
@Override
public String convertToString(Cursor cursor) {
return cursor.getString(5)+"<"+cursor.getString(3)+">";
}
@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(CommonDataKinds.Phone.DISPLAY_NAME);
buffer.append(") GLOB ?");
args = new String[] { constraint.toString().toUpperCase() + "*" };
}
return mContent.query(CommonDataKinds.Phone.CONTENT_URI, PEOPLE_PROJECTION,
buffer == null ? null : buffer.toString(), args,
CommonDataKinds.Phone.CONTACT_ID);
}
private ContentResolver mContent;
}
private static final String[] PEOPLE_PROJECTION = new String[] {
CommonDataKinds.Phone._ID,
CommonDataKinds.Phone.CONTACT_ID,
CommonDataKinds.Email.TYPE,
CommonDataKinds.Phone.NUMBER,
CommonDataKinds.Phone.LABEL,
CommonDataKinds.Phone.DISPLAY_NAME,
};
}