0

Following this solution I have run into an issue with the code presented. The app forces a close every time I pick a contact from the list that pops up. Something tells me the culprit has something to do with this which I found in logcat.

Here is my version of the code:

     public void onActivityResult(int reqCode, int resultCode, Intent data) {

    super.onActivityResult(reqCode, resultCode, data);

    switch (reqCode) {
        case (1) :
            if (resultCode == Activity.RESULT_OK) {
                Uri contactData = data.getData();
                Cursor cursor =  managedQuery(contactData, null, null, null, null);
                cursor.moveToFirst();
                String name = cursor.getString(cursor.getColumnIndexOrThrow(Contacts.People.NAME));
                String number = cursor.getString(cursor.getColumnIndexOrThrow(Contacts.People.NUMBER));
                name1.setText(name);
                num1.setText(number);
            }
            break;
    }
}

Take a look at the logcat

Community
  • 1
  • 1
CodeMonkeyAlx
  • 813
  • 4
  • 16
  • 32
  • `Contacts.People.NAME` has been deprecated from api level 5, Use `ContactsContract.PhoneLookup.DISPLAY_NAME`. – Pr38y Jun 25 '14 at 21:33
  • @Pr38y New methods have been added. Its still being a little punk and causing a crash when I pick said contact out of the list. Over all its progress since its starting to shape up and be less old in code. – CodeMonkeyAlx Jun 26 '14 at 11:38

0 Answers0