[android-developers] Re: Find existing contact by phone number
Worked great, thank you! On Sep 26, 3:57 pm, Mark Murphy [EMAIL PROTECTED] wrote: I am not sure what your managedQuery does, but does it move the cursor to the first position with moveToFirst()? Ludwig's probably correct. I actually just posted an errata to Version 1.2 ofmybook on this topic... Activity#managedQuery() probably returns a Cursor positioned before the first row. Try calling moveToFirst() on the Cursor after getting it back from managedQuery(). -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.2 Published! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---
[android-developers] Re: Find existing contact by phone number
I am not sure what your managedQuery does, but does it move the cursor to the first position with moveToFirst()? 2008/9/26 blim [EMAIL PROTECTED] We're building an application where we need to check if there is already an existing contact in the native Android phone book by searching by phone number and e-mail. I have a contact with the phone number: 123-456-7890 in my Contacts. In my application I'm doing the following, but nothing ever matches. Can somebody help me out? public Boolean matchingContacts() { Boolean matchesFound = false; String[] projection = new String[] { android.provider.Contacts.Phones.NUMBER, }; Cursor managedCursor = managedQuery(android.provider.Contacts.People.CONTENT_URI, projection, android.provider.Contacts.Phones.NUMBER + =\' + 123-456-7890 + \', null, null); if (managedCursor.isFirst()) { Log.d(MatchingContacts, Found a match!); } return matchesFound; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---
[android-developers] Re: Find existing contact by phone number
I am not sure what your managedQuery does, but does it move the cursor to the first position with moveToFirst()? Ludwig's probably correct. I actually just posted an errata to Version 1.2 of my book on this topic... Activity#managedQuery() probably returns a Cursor positioned before the first row. Try calling moveToFirst() on the Cursor after getting it back from managedQuery(). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.2 Published! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---