| Reply | « Previous Thread | Next Thread » |
|
//i have tested this code on NOKIA 6630 and NOKIA 6680.....
These are the variables used: private ContactList phoneList ; private String conListName[]; //0 - phone, 1 sim private PIM pimObject ; Contact contact ; /////the contents of the function goes like this pimObject = PIM.getInstance(); conListName = pimObject.listPIMLists(PIM.CONTACT_LIST); try { phoneList = (ContactList) (pimObject.openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE, conListName[0]));///for phone address book } catch (PIMException e) { return; } contact = phoneList.createContact(); ///adding name to the phonebook//it is done successfully String[] name1 = new String[phoneList.stringArraySize(Contact.NAME)]; if (phoneList.isSupportedArrayElement(Contact.NAME, Contact.NAME_GIVEN)) name1[Contact.NAME_GIVEN] = name; contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, name1); //adding telephone //this too is successful try { contact.addString(Contact.TEL, Contact.ATTR_HOME, number); } catch (Exception e) {} //commiting these to the phonebook try { contact.commit(); } catch (PIMException e) { } //here i make a image //this image 1900 bytes InputStream is = getClass().getResourceAsStream("/c.jpg"); try { int length = is.available(); b = new byte[length]; while (is.read() != -1) { is.read(b); } } catch (Exception e) { e.printStackTrace(); } ///i check here if this field(PHOTO) is supported if (phoneList.isSupportedField(Contact.PHOTO)) { try { contact.addBinary(110, Contact.ATTR_NONE, b, 0, b.length); } catch (Exception e) { } } try { contact.commit(); } catch (PIMException e) { //now error occurs here it say insufficient data content.Its actually //PIMException type 1(general error) showAlert = true; ee = Integer.toString(e.getReason()); } //any comments would be appreciated. //is there implementation problem in these phones |
| manik_jandial |
| View Public Profile |
| Find all posts by manik_jandial |
|
I don't know JSR-75 very well, but in the 6630 and 6680 Contacts database there's no longer (at least not based on the Contacts app user interface) any way to add a full-size photo; just a small thumbnail image.
Now the question is what this field is called/named & if it has any size and format restrictions (you seem to be trying to simply add a JPEG file byte by byte, which might not be OK). What if you use the Contacts app and add a thumbnail image and then attempt to read and export the thumbnail to a file & then try to see what format/size/resolution it is in (JPEG, BMP, MBM, PNG, whatever)? |
|
Yes i have tried that also.i mean i transferred the jpeg image to the phone memory and than added it (add thumbnail option) .
also i used(getBinary(int field,int index)), this function returns the thumbnail (bytes )..... retrieved the byte data (image) that i have uploaded manually....it returns me proper data. so that means it supports jpeg. I tried with different sizes like 8x8, 16x16,24x24,32x32,64x64,128x128,256x256 but of no use ...... |
| manik_jandial |
| View Public Profile |
| Find all posts by manik_jandial |
|
Is there any Nokia guys out there that could answer to this question. I've got the same problem on my Nokia 6680. If adding a photo to a contact is not implemented, then ok, but just tell it!!!
Thanx, David. |
|
Hi Manik and Dhalle,
I am getting the same error ("insufficient data content") while associating photo with a particular contact throug PIM api in nokia 6630. Please let me know if you people got any solution of this. I will be very thankfull to you guys.. Regards, Pankaj. Regards, Pankaj Hotwani. |
| pankaj_hotwani |
| View Public Profile |
| Find all posts by pankaj_hotwani |
|
Quote:
I am also trying to access photo of Contact. My code works well in emulator(WTK 2.5).. i.e. I am able create image using the byte[] returned by the metod getBinary(int field,int index). But in Nokia 6630 its not working. The byte[] returned by the method getBinary(int field,int index) in Nokia 6630 can't create image. I noticed that, the values of byte[] returned by the method getBinary(int field,int index) in emulator are varies from -127 to +127 but in nokia 6630 its varies from 0 to +127. And for the same photo of same Contact (I transfered the vCard from handset to emulator) the length of byte[] returned by the method getBinary(int field,int index) in handset is more than that of emulator. So i am unable to create the image.. Can anybody help me? |
| sunil_talent |
| View Public Profile |
| Find all posts by sunil_talent |
|
Hi All
I got the solution to my problem. In Nokia 6630, the byte array returned by the getBinary(field,index) method is the encrypted one. (BASE64). I decrypted this byte array, and using the resulted decrypted array , i craeted the image. Now Its working fine on nokia 6630. i.e. Now i am able to display the photo of a Contact. |
| sunil_talent |
| View Public Profile |
| Find all posts by sunil_talent |
|
Hi all,
I am trying to add a picture as you are saiding, sunil_talent. But always I am receiving "The item has insufficient data content". This is my function: public void createContact () { ContactList phoneList ; String conListName[]; //0 - phone, 1 sim PIM pimObject ; Contact contact; String name = "is"; String number = "123"; byte b[] = null;; pimObject = PIM.getInstance(); conListName = pimObject.listPIMLists(PIM.CONTACT_LIST); try { phoneList = (ContactList) (pimObject.openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE, conListName[0]));///for phone address book } catch (PIMException e) { return; } //PIMItem contact = (PIMItem) phoneList .createContact (); contact = phoneList.createContact(); ///adding name to the phonebook//it is done successfully String[] name1 = new String[phoneList.stringArraySize(Contact.NAME)]; if (phoneList.isSupportedArrayElement(Contact.NAME, Contact.NAME_GIVEN)) name1[Contact.NAME_GIVEN] = name; contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, name1); //adding telephone //this too is successful try { contact.addString(Contact.TEL, Contact.ATTR_HOME, number); } catch (Exception e) { } try { contact.commit(); } catch (PIMException e) { } byte raw[] = null; try { Image newImage = Image .createImage ("/image.png"); raw = getByteArray(newImage); } catch (Exception e) { e.printStackTrace(); } ///i check here if this field(PHOTO) is supported if (phoneList.isSupportedField(Contact.PHOTO)) { try { byte encoded[] = Base64.encode(raw); System.out.println ("encoded length = " + encoded.length); contact .addBinary (Contact.PHOTO, Contact.ATTR_NONE, encoded, 0, encoded.length); contact .commit(); } catch (Exception e) { e.printStackTrace(); } } } Please help me!! Thanks manik_jandial for your help too. Regards. ismalg |
|
Any idea, please?
ismalg. |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Contact List Picture Size | Tall-Guy | Mobile Java Media (Graphics & Sounds) | 0 | 2004-04-10 16:52 |
| Nokia Comunicator 9500 | alvisone | General Discussion | 2 | 2004-03-01 08:01 |
| Create Contact Item with Ringtone and Picture | y10913 | General Symbian C++ | 0 | 2004-02-27 19:01 |
| Nokia Mobile VPN Client | marcyl | Symbian Networking & Messaging | 1 | 2003-12-01 15:47 |
| Nokia 3310 - Smart Messaging compatibility | Nokia_Archive | Smart Messaging | 2 | 2002-05-22 14:22 |