in my app I need to point the user to the contact list, and then receive a selection. I found a very descriptive tutorial, but I keep getting an uncaught exception.
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
case CONTACT_PICKER_RESULT:
Bundle extras = data.getExtras();
Set<String> keys = extras.keySet(); //NullPointerException on this line
Iterator<String> iterate = keys.iterator();
while (iterate.hasNext()) {
String key = iterate.next();
Log.v(DEBUG_TAG, key + "[" + extras.get(key) + "]");
}
Uri result = data.getData();
Log.v(DEBUG_TAG, "Got a result: "
+ result.toString());
break;
}
}
}
EDIT: Here is the Runtime Exception that is caused by the NullPointerException shown before.
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1001, result=-1, data=Intent { dat=content://com.android.contacts/contacts/lookup/0n293F45435B45/1 }} to activity {com.ptylabs.loveyousms/com.myapps.myApp.MyActivity}: java.lang.NullPointerException
And yes, I have the permissions set.
Any ideas whats going on? Thanks!