FileDocCategorySizeDatePackage
EmailAddressAdapter.javaAPI DocAndroid 1.5 API2952Wed May 06 22:42:46 BST 2009com.android.email

EmailAddressAdapter

public class EmailAddressAdapter extends android.widget.ResourceCursorAdapter

Fields Summary
public static final int
NAME_INDEX
public static final int
DATA_INDEX
private static final String
SORT_ORDER
private android.content.ContentResolver
mContentResolver
private static final String[]
PROJECTION
Constructors Summary
public EmailAddressAdapter(android.content.Context context)


       
        super(context, R.layout.recipient_dropdown_item, null);
        mContentResolver = context.getContentResolver();
    
Methods Summary
public final voidbindView(android.view.View view, android.content.Context context, android.database.Cursor cursor)

        TextView text1 = (TextView)view.findViewById(R.id.text1);
        TextView text2 = (TextView)view.findViewById(R.id.text2);
        text1.setText(cursor.getString(NAME_INDEX));
        text2.setText(cursor.getString(DATA_INDEX));
    
public final java.lang.StringconvertToString(android.database.Cursor cursor)

        String name = cursor.getString(NAME_INDEX);
        String address = cursor.getString(DATA_INDEX);

        return new Address(address, name).toString();
    
public android.database.CursorrunQueryOnBackgroundThread(java.lang.CharSequence constraint)

        String where = null;

        if (constraint != null) {
            String filter = DatabaseUtils.sqlEscapeString(constraint.toString() + '%");

            StringBuilder s = new StringBuilder();
            s.append("(people.name LIKE ");
            s.append(filter);
            s.append(") OR (contact_methods.data LIKE ");
            s.append(filter);
            s.append(")");

            where = s.toString();
        }

        return mContentResolver.query(CONTENT_EMAIL_URI, PROJECTION, where, null, SORT_ORDER);