0

I'm trying to develop an android app at the moment. Right now I want to get the phone number of a selected contact. I enter my contact list with ContactsContract, and I also get the data of a contact by the Cursor object I use. My Problem is I get the first contact every time because of the .moveToFirst() method I use. Of course I tried to do it without this method, but then cursor.getPosition() returns '-1', so I get an error in the .getColumnIndex() method. I also tried to use .moveToPosition, but I don't know how to get the right position of my selected contact.

Can anyone help me?

Froxx
  • 957
  • 4
  • 14
  • 27
  • http://stackoverflow.com/questions/21275118/getting-name-phone-number-and-email-address-from-phone-contacts/21275142#21275142 – Digvesh Patel Jan 24 '14 at 10:53
  • Thank you, because of this I found the mistake in my code. While creating my Cursor I made the query not to the Intent i recieved with the onActivityResult() method (so 'data' in most cases), but to my created URI in that method (ContactsContract.CommonDataKinds.Phone.CONTENT_URI;). It workz! – Froxx Jan 24 '14 at 11:47
  • wel come dude have a great time – Digvesh Patel Jan 24 '14 at 11:47

0 Answers0