4

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.

Pim Reijersen
  • 1,123
  • 9
  • 33

2 Answers2

1

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

Community
  • 1
  • 1
Kiwy
  • 340
  • 2
  • 10
  • 43
  • It seems impossible to catch the intent android.intent.action.INSERT with broadcast receiver, so if any of you has a solution... – Kiwy Jun 16 '12 at 13:03
1

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.

Arun George
  • 18,352
  • 4
  • 28
  • 28
  • It works. too bad for the bounty, do you know if it works with ICS ? – Kiwy Jun 25 '12 at 09:26
  • I suppose you checked this answer pretty late. Anyway I have tested this code and it does work in ICS. – Arun George Jun 25 '12 at 09:30
  • sorry I was just not in front of my computer the whole weekend. I tested it ! It's working great both 2.3 and 4.x you save my day ! – Kiwy Jun 25 '12 at 09:40
  • Always happy to help. If this is indeed the answer to your problem accept it as the right answer. Will be helpful for others. – Arun George Jun 25 '12 at 09:42