managedQuery - trying to make 2 data points show when clicked

Posted by fitz on Stack Overflow See other posts from Stack Overflow or by fitz
Published on 2010-12-22T22:50:50Z Indexed on 2010/12/22 22:53 UTC
Read the original article Hit count: 188

Filed under:

Here is what I have now: ListAdapter buildPhonesAdapter(Activity a) { String[] PROJECTION=new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Phone.NUMBER, Email.DATA }; Cursor c=a.managedQuery(Phone.CONTENT_URI, PROJECTION, null, null, null);

    return(new SimpleCursorAdapter( a,
                                                                    android.R.layout.simple_list_item_2,
                                                                    c,
                                                                    new String[] {
                                                                        Contacts.DISPLAY_NAME,
                                                                        Phone.NUMBER,
                                                                        Email.DATA
                                                                    },
                                                                    new int[] {
                                                                        android.R.id.text1,
                                                                        android.R.id.text2

                                                                    }));




}

ListAdapter buildEmailAdapter(Activity a) {
    String[] PROJECTION=new String[] {  Contacts._ID,
                                                                            Contacts.DISPLAY_NAME,
                                                                            Email.DATA
                                                                        };
    Cursor c=a.managedQuery(Email.CONTENT_URI,
                                                    PROJECTION, null, null, null);

    return(new SimpleCursorAdapter( a,
                                                                    android.R.layout.simple_list_item_2,
                                                                    c,
                                                                    new String[] {
                                                                        Contacts.DISPLAY_NAME,
                                                                        Email.DATA
                                                                    },
                                                                    new int[] {
                                                                        android.R.id.text1,
                                                                        android.R.id.text2
                                                                    }));
}

Need the 2 variables to show when cursor is picking this new option - I need Email.CONTENT_URI, and Phone.CONTENT_URI, to show when picked - I can get each one to show but need them both to show at same time.

© Stack Overflow or respective owner

Related posts about android