Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User markchua_99's Avatar
    Join Date
    Apr 2008
    Posts
    12
    Good Day to all,

    I need help on how to display the photo of a phone contact/Contact object of the PIM API under the S40 3rd Edition (initial release, before Feature Pack 1). I am making a MIDlet that needs to display the photo contained within a contact inside the said program. It is similar to the Phone's view contact details in its function.

    The problem is that the photo is not included in the supported Fields when I check the ContactList object thus cannot be read inside the java program. However, if I used the S40 5th edition as a platform (using exactly the same code), the photo is available and can be read inside the program.

    Also, when importing a vcard using the "fromSerialFormat" and committing the receive contact, the contact is saved with its photo intact (S40 3rd Edition initial release, before Feature Pack 1 was used here); exporting vcard is also perfectly working on exporting its photo. Thus technically the S40 3rd edition initial release could read the photo. With that said, How am I able to read the photo inside the java program(if it is a limitation, are there any workaround?). I really need to make it work for a s40 3rd edition initial release platform so as to support more phones

    Any help would be greatly appreciated. Thank you very much.

    Here is the code snippet that displays the contact details:
    "ContactContent" is a class that parses the Contact to extract the given name, last name, and tel number of a contact
    "ContactPic" is an instance of javax.microedition.lcdui.ImageItem object found in netbeans

    Code:
        public void fillContactInfo(int nSelected) {
            try {
                Contact c = (Contact) CurrentContactsList.elementAt(nSelected);
                int[] dataFields = c.getFields();
                for (int i = 0; i < dataFields.length; i++) {
                    switch (dataFields[i]) {
                        case Contact.NAME:
                            ContactContent contact = new ContactContent();
                            contact.setValues(c);
                            NameDisplayModel.setValue(1, 0, contact.strFirstName);
                            NameDisplayModel.setValue(1, 1, contact.strLastName);
                            NameDisplayModel.fireTableModelChanged();
                            // NameDisplayModel.
                            break;
                        case Contact.TEL:
                            String[][] strNos = new String[c.countValues(Contact.TEL)][1];
                            for (int j = 0; j < c.countValues(Contact.TEL); j++) {
                                strNos[j][0] = c.getString(Contact.TEL, j);
                            /*                        switch(c.getAttributes(Contact.TEL, j)){
                            case Contact.ATTR_HOME:
                            break;
                            case Contact.attr
                            }*/
                            }
                            PhoneModel.setValues(strNos);
                            PhoneModel.fireTableModelChanged();
                            //PhoneModel.setValues(values);
                            break;
                        case Contact.PHOTO_URL:
                        case Contact.PHOTO:
                            byte[] pic = c.getBinary(Contact.PHOTO, 0);
                            ContactPic.setImage(Image.createImage(pic, 0, pic.length));
                            break;
                    }
                }
            } catch (Exception ee) {
                ee.printStackTrace();
            }
        }
    Last edited by markchua_99; 2008-05-14 at 04:18. Reason: typo and added details

  2. #2
    Registered User jsia18's Avatar
    Join Date
    Jun 2008
    Posts
    3
    Please Somebody Help Us!!

  3. #3
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    If PHOTO field is not a supported field, then you'll not be able to access a contact's photo in your Java ME app.

    Pit

  4. #4
    Registered User markchua_99's Avatar
    Join Date
    Apr 2008
    Posts
    12
    That is my problem.... the phone j2me does not support photo field but the phone contacts itself does. and for some reason if I import using the import function of PIM API in j2me a vcard with a photo in it, though I am not able to read or even know that the photo is there, the phone somehow saves the photo along with the contact with no problem at all.

    so is it java VM that does the reading of the vcard or the phone OS itself directly.

    Also, Is there a way to use the vcard decoder to read photo from it.

  5. #5
    Registered User zsu0915's Avatar
    Join Date
    Dec 2007
    Posts
    2
    Hi,

    I have the same problem. I think Nokia should provide more accurate information about the implementation dependent parts of their J2ME implementations.

    By the way, can you enlight me which S40 5th edition device you have tried on?

    Jimmy

  6. #6
    Registered User markchua_99's Avatar
    Join Date
    Apr 2008
    Posts
    12
    Sorry, I have not yet tried on an actual series 40 5th edition phone, only series 40 3rd edition FP3 - Nokia 3110 classic.

  7. #7
    Nokia Developer Expert grandlu's Avatar
    Join Date
    Jun 2008
    Posts
    3
    2010 and still the same problem, has this thread ever been solved? Bug? Workaround? Any help would be appreciated. Thank you.

Similar Threads

  1. Replies: 7
    Last Post: 2007-11-30, 14:49
  2. Sending email from E61 S60 3rd edition phone
    By waynej2 in forum Mobile Java General
    Replies: 1
    Last Post: 2007-09-13, 21:18
  3. Problem emulating S40 3rd Edition
    By Mantu in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2007-05-15, 14:59
  4. Record sound on S40 3rd edition device
    By madsbjoern in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-09-21, 09:55
  5. 6280 != S40 3rd Edition
    By henson2K in forum General Development Questions
    Replies: 0
    Last Post: 2005-07-27, 19:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved