I cannot think of a way to write such a query. What you can do instead is perform separate searches for the different data types and then intersect the results using some java data structure like a HashSet of contact ids. On Aug 4, 2010 5:27 PM, "Bijan" <[email protected]> wrote: > I am trying to do a Contacts search on Android using ContactsContract. > > I would like to search on multiple parameters, e.g. - Where name = > myname AND email = myemail AND nickname = mynickname, etc. > > I have it working w/ just name, but need the syntax to add email and > nickname as search params. I know they are stored separately from > display name & have a different format. The code below is what is > working for the search by just name. > > How can I add to the selection variable to also search by email and > nickname? > > CODE: > > > String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " > = '" + ("1") + "'"; > selection += "AND " + ContactsContract.Contacts.DISPLAY_NAME + "= > '" + cp.name + "'"; > Uri uri = ContactsContract.Contacts.CONTENT_URI; > String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " > COLLATE LOCALIZED ASC"; > Cursor myCursor = mApp.managedQuery(uri, null, selection, null, > sortOrder); > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

