开发者

Why does this code throw ActivityNotFoundException?

Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(vc.cellphone));

Intent intent = new Intent(); intent.setAction(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(lookupUri); getApplicationContext().startActivity(intent);

The contact with cell phone number the same as vc.cellphone开发者_如何学运维 is in the contacts.


I'm wondering if your Uri is the problem. What about trying this:

Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT);
intent.setData(Uri.fromParts("tel", vc.cellphone, null));
startActivity(intent);

Edit - I tried this in the emulator and it works, say, if vc.cellphone is "1234567890".

Do you have additional code involved with this intent?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜