user3124780
user3124780

Reputation: 83

calling android contacts application (by an intent ) inside an activity

How to call Android contacts app inside an activity. The activity may contains other controls like button, but somewhere (inside the same activity) it displays the contacts app so that i can perform certain actions like add, view, edit etc. By actions, i mean the actions that Android contacts app provides. Following code calls android contacts app as an intent:

    Intent i = new Intent();
    i.setComponent(new ComponentName("com.android.contacts", "com.android.contacts.DialtactsContactsEntryActivity"));
    i.setAction("android.intent.action.MAIN");
    i.addCategory("android.intent.category.LAUNCHER");
    i.addCategory("android.intent.category.DEFAULT");
    startActivity(i);

Upvotes: 0

Views: 549

Answers (1)

MSaudi
MSaudi

Reputation: 4652

It does not work like this. You can not add another app inside your app. You can use Content Providers for app functionality with contacts (e.g. to add/edit/remove contacts progmatically). or use intents with action View, Edit or Pick to handle the contact inside the contact application itself.

Upvotes: 1

Related Questions