Adding contact to the phone problem

Hi all

I'm trying to add a contact to the list of contacts from the phone, able to copy the following code:

try
{
      ContactList contacts = null;
      try {
         contacts = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
      } catch (PIMException e) {
         // An error occurred
         return;
      }
      Contact contact = contacts.createContact();

     String[] name = new String[ contacts.stringArraySize( Contact.NAME ) ];
     name[Contact.NAME_GIVEN] = "Kate";
     name[Contact.NAME_FAMILY] = "Turner";
     contact.addStringArray(Contact.NAME, Contact.ATTR_NONE, name);

     AddressBookArguments entry = new AddressBookArguments(AddressBookArguments.ARG_COMPOSE, contact);

     Invoke.invokeApplication(Invoke.APP_TYPE_ADDRESSBOOK, entry);

}
catch (Exception e)
{
    System.out.println("erreur ms avt ps disp addContactToRep " + e.getMessage());
    e.printStackTrace();
}

but I get an exception while debugging, on the line "entry AddressBookArguments = new AddressBookArguments (AddressBookArguments.ARG_COMPOSE, contact);

The error is: invalid argument

I am using the code introduced by the api, but it seems that what I wrote is false...

Could you please help me?

Thank you.

Hello

You can try to climb the PIm.getInstance () to BlackBerryContactList instead of the contact list.

You may need to change the AddressBookArguments.ARG_COMPOSE of AddressBookArguments. ARG_NEW.

Hope that will help you.

Tags: BlackBerry Developers

Similar Questions

  • Adding contacts on the phone

    Hello world

    in my application I want to save the contacts to the phone, this part works perfectly.

    My problem is when I add contacts to the phone, for example research in the forum I found this link: http://supportforums.blackberry.com/t5/Java-Development/Problem-adding-contact-to-phone/m-p/341728/h...

    There, I found this code:

    try
    {
          ContactList contacts = null;
          try {
             contacts = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
          } catch (PIMException e) {
             // An error occurred
             return;
          }
          Contact contact = contacts.createContact();
    
         String[] name = new String[ contacts.stringArraySize( Contact.NAME ) ];
         name[Contact.NAME_GIVEN] = "Kate";
         name[Contact.NAME_FAMILY] = "Turner";
         contact.addStringArray(Contact.NAME, Contact.ATTR_NONE, name);
    
         AddressBookArguments entry = new AddressBookArguments(AddressBookArguments.ARG_COMPOSE to AddressBookArguments.ARG_NEW, contact);
    
         Invoke.invokeApplication(Invoke.APP_TYPE_ADDRESSBOOK, entry);
    
    }
    catch (Exception e)
    {
        System.out.println("erreur ms avt ps disp addContactToRep " + e.getMessage());
        e.printStackTrace();
    }
    

    with this code, I can add a contact... but one by one and the user to save this contact.

    How can I add all the contacts I need automatically?

    PS: Sorry for my English.

    I found the answer here:

    http://supportforums.BlackBerry.com/T5/Java-development/saving-a-contact-in-adress-book/m-p/147727#M...

  • Bought one from Best Buy Apple Watch that had been returned. Original purchaser cannot be contacted. The phone is synchronized to their account, how can I sync to mine?

    Bought one from Best Buy Apple Watch that had been returned. Original purchaser cannot be contacted. The phone is synchronized to their account, how can I sync to mine?

    You can not. Take it back to Best Buy and ask for a refund.

  • Can I export the contacts from the phone or MotoBLUR?

    And before you answer - 'of course, copy them to the SIM card"- I want to EXPORT the contacts from the phone.

    I see that I can import contacts on the phone to CSV on the MotoBLUR page, but I can't export.

    I think that there is a demand of "exportcontacts" in the app store - there can be several - which allows you to export the Android contacts to a CSV file on your SD card.

  • Transferring contacts from the phone to the sim card

    Help. How can I transfer my data from contacts from the phone to the sim card. I have a new phone and this would save back me them all manually. Ray.

    To allow a person to help, can you provide Details view please? as brands and models of phones, etc.

    If Lumia see http://www.microsoft.com/en-us/mobile/support/faq/?action=singleTopic&topic=FA140263 which shows information on how to transfer some details via Bluetooth, etc.

  • BlackBerry store contacts from the phone to the memory card

    Hi all

    I'm new to cascades of blackberry development.

    I want to develop an application where I can store all contacts from the phone to memory card, then plugin this memory card to another blackberry phone and retrieve. Development must be done using waterfalls

    Please tell about how to proceed. Any help/link would be appreciated.

    Thank you best regards &,.

    Tushar

    I would say using the vcard format established for this.

    See
    https://developer.BlackBerry.com/native/reference/Cascades/bb__pim__contacts__contactservice.html?f=...
    and the appropriate import function

  • BlackBerry 10 remote search lack of Contacts in the phone app

    Remote research is available under the dedicated Contact requests, but not under the list of contacts in the phone application. Am I missing a setting or is this a missing feature?

    Hey DHungate,

    Thanks for the question.

    The look-up under the phone app is reserved for local contacts.  Remote research is available in the contacts app in BlackBerry 10.

    Let me know if you have any other questions.

    See you soon.

  • Xperia M4 aqua does not display the names of contact on the phone application

    Hi all

    I jave an Xperia M4 aqua E2306 running Android 5.0. The problem I have is that the Contacts application shows all my contacts synchronize accounts such as Facebook or Google, but the application of the phone itself does not show the names of contacts only contact phone numbers, I went through the settings and I can't find something that will allow me to change this behavior, I deleted the cache of the phone on the settings and rebooted my phone application , but who doesn't. I have many applications installed and downloaded and lots of settings so that I don't want to factory default my phone unless I extremely need of. Any ideas?

    Thanks in advance,

    Jay.

    Factory reset worked just fine. Thank you all :-)

  • BlackBerry smartphones lack all the contacts in the phone after the backup (via Desktop Manager)

    Hi - my tour 9630 died, and after getting a new phone from verizon has opened the Office Manager to run the restore. I have now NO telephone contacts at all in my address book, but all my single email yahoo contacts are now in my phone. How can I recover my phone contacts?

    WOW, FIXED! OK, so after playing with the phone for a while, I noticed another problem - I have had wayyyyy too much e-mail contcts; as in every yahoo only contact had synced my phone. so I went Googling issuing telephone directories, options and rset type who turned off Wi - Fi sync. then I restored (for the billionth time) and voila! no more contacts additional email and phone contacts are back.

    Weird question and I wonder if this is normal?

    is it possible to be notified before restoration you must disable your wireless sync (which I didn't even know was)?

    Thank you blackberry forums! you solved my problem again!

  • BlackBerry 10 Calling of contacts using the phone? Is this possible?

    So, what don't get me?  I use the phone, use the phone contacts icon, select my contacts but I can't understand how to call this contact... the number indicates the contact but I can't find an option to compose...

    I can go to Contacts and select the contact and then select call, but why not in the app phone itself?

    My lamp has done, why not not new/latest smartphone?

    Someone please give me advice on what I'm missing...

    Nevermind... instead of a long press or button, just type... Oh...

  • Adding contacts to the people app

    How can I add contacts from my Yahoo account in the application of people, when Yahoo is not listed as a choice?

    Hello

    You will not be able to add yahoo account or his contact in the people app, given that this option is not available in the people app.

    I hope that answers your question. If you have other problems with Windows, please post in the Microsoft Community. We would be happy to help you.

  • Save text pictures on the phone problem

    I have a photo sent by SMS that I want to record on my phone, so I can send by e-mail. When I opened the peak on the text message, I hold my finger on the photo, but the flash menus upwards and disappear instantly. I tried power off and restart the phone... same thing.

    Any ideas?

    Thank you.

    Long press corps text on the attachment, do not open the pic.  Who give a shot.

  • Problem adding contacts to the directory blackBerry Smartphones

    Hello!

    I have a two year old curve 8520. Suddenly, I am facing a problem. I'm not able to add a new contact or edit existing contact. I rebooted my phone number of times but the problem persists. How can I solve this?

    Why not try to remove "YM", delete it.

    Not sure, is that Yahoo Messenger or YouMail?

    Remove it from your applications.

    Reset.

    Retest the addressbook.

  • Is there any application to copy contacts from the phone android - att to verizon iPhone SE

    I want to copy all my contacts from my android phone (nexus 5 LG) which is at & t locked on my new iPhone IS which is locked Verizon.

    Is there any application I can use for backup and copy over the clouds. I don't want to add all these contacts 1000 + to my vision of the laptop.

    Assuming that you are syncing contacts on your Android phone with your gmail account, you can just sync them down to the iPhone by adding your gmail account.

  • I'm buying his stating I am in the United States when I click on it it tell me to contact, but the phone number is disconnected

    why I manage to buy, I am not located in the United States and its does not give me an option to change but told me to call the number that is disconnected. It is this same legitimate?

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

Maybe you are looking for

  • CTRL-w is not close window

    It seems that, in recent weeks, Firefox is no longer closes a window when you press ctrl-w even if there is only one tab in the window. What I mean is that, if I open a new window (ctrl-n), it does not close if I press on ctrl-w (or ctrl + F4) immedi

  • 27 k310ne: 27 - k310ne ENVY27 - 2 extra monitors Possible?

    Hello I have an ENVY 27 inclination and I connected a second monitor with an adapter EVGA UV + 39 to a USB port. I would much appreciate if you can tell me if the system supports an additional monitor to the other usb port or is there another way to

  • HP Pavilion 15-p086na: win 8

    Hi I wounder if anyone can help me please...Computer hp laptop, I bought 4 months ago brand new all the pre installed os & software no disks... Well my son thought it wise to go bak to win 7 as it is win 8 waz a bit naf, so he completely try it with

  • HPDESKJET 2540 SERIES installation problems

    Dear Jabzi I installed the Windows fix as you suggest, but I still get the error at the end of the installation process. With regard to the second option (GPEDIT. (MSC), this tool is not available on Windows 7 Home, which is my OS, so I did not try i

  • How can I keep the photo files id3 tagging? (And video files?)

    Hello. This question is about id3 tagging files photo (and video?). Probably, it revolves around managing the media too. I have tif and jpg files that I took of the old and the new point and shoot cameras. What I'm trying to do, is to have jpg and ti