Hallo!
Ich habe einen Button, welcher die Kontaktliste öffnet und dann soll der ausgewählte Kontakt angezeigt werden.
Dafür habe ich folgenden Code:
select.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
}
});
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();
Iterator<String> iterate = keys.iterator();
while (iterate.hasNext()) {
String key = iterate.next();
Log.v("ICH", key + "[" + extras.get(key) + "]");
}
Uri result = data.getData();
Log.v("ICH", "Got a result: "
+ result.toString());
break;
}
} else {
// gracefully handle failure
Log.w("ICH", "Warning: activity result not ok");
}
}
Alles anzeigen
Folgender Fehler tritt dabei auf:
ZitatAlles anzeigen11-14 08:09:31.837: E/AndroidRuntime(25749): FATAL EXCEPTION: main
11-14 08:09:31.837: E/AndroidRuntime(25749): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1001, result=-1, data=Intent { dat=content://com.android.contacts/contacts/lookup/3866i7ce28d2d08412d2a/511 flg=0x1 }} to activity {de.gvisions.oweapp/de.gvisions.oweapp.NewItem}: android.content.res.Resources$NotFoundException: String resource ID #0xffffffff
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.app.ActivityThread.deliverResults(ActivityThread.java:3310)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3353)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.app.ActivityThread.access$1100(ActivityThread.java:145)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1259)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.os.Looper.loop(Looper.java:137)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.app.ActivityThread.main(ActivityThread.java:4978)
11-14 08:09:31.837: E/AndroidRuntime(25749): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 08:09:31.837: E/AndroidRuntime(25749): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 08:09:31.837: E/AndroidRuntime(25749): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
11-14 08:09:31.837: E/AndroidRuntime(25749): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
11-14 08:09:31.837: E/AndroidRuntime(25749): at dalvik.system.NativeStart.main(Native Method)
11-14 08:09:31.837: E/AndroidRuntime(25749): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xffffffff
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.content.res.Resources.getText(Resources.java:249)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.widget.Toast.makeText(Toast.java:265)
11-14 08:09:31.837: E/AndroidRuntime(25749): at de.gvisions.oweapp.NewItem.onActivityResult(NewItem.java:71)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.app.Activity.dispatchActivityResult(Activity.java:5192)
11-14 08:09:31.837: E/AndroidRuntime(25749): at android.app.ActivityThread.deliverResults(ActivityThread.java:3306)
11-14 08:09:31.837: E/AndroidRuntime(25749): ... 11 more
Wo liegt da der Fehler?
Gruß
Alex