Pim Reijersen
Pim Reijersen

Reputation: 1133

Custom fields on new contact

new contact

This is the 'add new contact' window. Is it possible to create custom data fields in this window?

My current custom fields are only visible on the 'contact details' window.

Upvotes: 4

Views: 1647

Answers (2)

Arun George
Arun George

Reputation: 18592

It is possible to launch a new Add New Contact activity when the user clicks on the add new contact button. For that you will have to create your own activity and setContentView(R.layout.YOUR_CUSTOM_ACTIVITY_SCREEN). Now the next step is important. Add the following lines to the ManifestFile of your application:

<activity android:name=".YOUR_CUSTOM_ACTIVITY" >
        <intent-filter>
            <action android:name="android.intent.action.INSERT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.dir/contact"/>
        </intent-filter>
    </activity>

Now when the user click to add a new contact he will be shown 2 options. One will be your application and other would be the default activity to add contact.

Hope this answer helps.

Upvotes: 1

Kiwy
Kiwy

Reputation: 346

It seems like the only way to do it, is to catch the intent and show you're own edit contact activity( at least with android 2.1 and 2.3 ). I tries all day long to make a workable BroadcastReceiver working. but I never succed.

source : https://groups.google.com/forum/?fromgroups#!topic/android-developers/bKpXE1kn4kI and Custom accountType "edit contact" and "add contact" shows only name

Upvotes: 1

Related Questions