×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    42

    enter number from application

    How to save a number from j2me application into mobile phonebook

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,557

    Re: enter number from application

    Read up on JSR-75 and PIM APIs. Also sample code in the wiki for this, if my memory serves me correctly.

  3. #3
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: enter number from application

    Hi praran910,

    you can access and manage phonebook in Java ME by using PIM API. Some introductory articles about it are available here:

    http://developers.sun.com/mobility/apis/pim/pim1/
    http://developers.sun.com/mobility/apis/pim/pim2/

    For more details you can check out Java ME Developer's Library:
    http://www.forum.nokia.com/document/...B154D2A3F.html

    And here you've got full PIM API's JavaDocs:
    http://www.forum.nokia.com/document/...w-summary.html

    Finally, some useful code examples:
    http://wiki.forum.nokia.com/index.ph...s_using_JSR_75
    http://bittyjava.wordpress.com/2006/...e-pim-example/

    Hope it helps,
    Pit

  4. #4
    Registered User
    Join Date
    Jan 2008
    Location
    Pune
    Posts
    24

    Re: enter number from application

    hi praran910,
    This code will help you:
    public void storeData()
    {
    String fName = "FirstName";
    String lName = "lastname";
    String phNumber = "1234567890";

    ContactList clist=null;
    Contact c=null;
    try {
    clist = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);

    } catch(Exception e) {
    // security or other exception
    }
    String[] name = new String[clist.stringArraySize(Contact.NAME)];
    //Add contact values
    /*------------------------------------------*/
    c = clist.createContact();
    if (clist.isSupportedArrayElement(Contact.NAME, Contact.NAME_GIVEN))
    name[Contact.NAME_GIVEN] = fName;
    c.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, name);

    if (clist.isSupportedField(Contact.TEL))
    {
    if(!phNumber.equals(""))
    c.addString(Contact.TEL, Contact.ATTR_OTHER, phNumber); //OTHER
    }
    /*------------------------------------------*/
    // Add the item to the native contact database
    try{
    c.commit();
    }catch(PIMException e){}


    try {
    clist.close();
    } catch (PIMException e) {}

    }

    anjan

Similar Threads

  1. enter number from application
    By praran910 in forum General Development Questions
    Replies: 3
    Last Post: 2008-08-19, 12:17
  2. Replies: 2
    Last Post: 2006-07-05, 23:15
  3. Replies: 4
    Last Post: 2006-05-24, 08:46
  4. Personal
    By JSmith77 in forum PersonalJava
    Replies: 4
    Last Post: 2003-07-30, 12:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×