Page 1 of 2 12 LastLast
Results 1 to 20 of 24
  1. #1
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default contact information

    Hi All

    I am trying to get BlackBerry contact information through code like Nmae,number etc.Please help me

    How can i get contact information?

  2. #2
    imorio is offline Senior Member
    Join Date
    Aug 2010
    Posts
    127
    Rep Power
    0

    Default

    What have you tried so far?

  3. #3
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Quote Originally Posted by imorio View Post
    What have you tried so far?
    Thanks for reply.
    Honestly i just find api
    Java Code:
    javax.microedition.pim.*
    I try to find article.If you have any article link or Idea then please give me

  4. #4
    imorio is offline Senior Member
    Join Date
    Aug 2010
    Posts
    127
    Rep Power
    0

    Default

    All java classes from java at:
    All Classes (Java 2 Platform SE v1.4.2)

  5. #5
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Quote Originally Posted by imorio View Post
    All java classes from java at:
    All Classes (Java 2 Platform SE v1.4.2)
    Thank for reply
    I know that where is java classes.My problem is how to start to get contact information?
    Can you give me some example link.
    Thanks in advance

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  7. #7
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Thanks for response ..

    When i try to run PhotoExample of BlackBerry JDE 4.5.0 API Reference: Interface Contact.Then i am getting Uncaught exception: Java.long.NullPointrtException.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Okay, those things are general exceptions comes up with in developments. And you are working on the IDE as well. So why don't you try to debug the code my friend. Just add some break-points and try it out. And also look at the exception stack trace, you can find a lot from there.

    Post the message here to see.

  9. #9
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    I debug code i found where is exception generate.
    Java Code:
     import java.io.IOException;
     import javax.microedition.pim.Contact;
     import javax.microedition.pim.ContactList;
     import javax.microedition.pim.PIM;
     import javax.microedition.pim.PIMException;
     import javax.microedition.pim.PIMItem;
     import net.rim.device.api.io.Base64InputStream;
     import net.rim.device.api.io.Base64OutputStream;
     
     public class PhotoExample
     {
     
         private Contact _contact;
     
         public PhotoExample() throws PIMException
         {
             ContactList contactList = (ContactList) PIM.getInstance().openPIMList(
                     PIM.CONTACT_LIST, PIM.READ_WRITE );
             _contact = contactList.createContact();
         }
     
         public void setPhoto() throws IOException
         {
             byte[] photo = getSamplePhoto();
             byte[] photoEncoded = Base64OutputStream.encode( photo, 0,
                     photo.length, false, false );
             if( _contact.countValues( Contact.TEL ) > 0 ) {
                 _contact.setBinary( Contact.TEL, 0, PIMItem.ATTR_NONE,
                         photoEncoded, 0, photo.length );
             } else {
                 _contact.addBinary( Contact.TEL, PIMItem.ATTR_NONE, photoEncoded,
                         0, photo.length );
             }
         }
     
         public byte[] getPhoto() throws IOException
         {
             if( _contact.countValues( Contact.TEL ) > 0 ) {
                 byte[] photoEncoded = _contact.getBinary( Contact.TEL, 0 );
                 return Base64InputStream.decode( photoEncoded, 0,
                         photoEncoded.length );
             } else {
                 return null;
             }
         }
     
         private static byte[] getSamplePhoto()
         {
             // return the raw bytes of the photo to use
             return null;
         }
     
         public static void main( String[] args ) throws Throwable
         {
             PhotoExample example = new PhotoExample();
             example.setPhoto();
             example.getPhoto();
         }
     
     }
    exception Generate here
    Java Code:
      private static byte[] getSamplePhoto()
         {
             // return the raw bytes of the photo to use
             return null;
         }
    getSamplePhoto retun Null.
    What i do here i have no idea.Can you tell me what i do here?
    Thanks in advance..

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  12. #12
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    You've to read an image and pass the relevant byte stream, which is not implement yet.
    Yes you are right i havn't read image or contact number.
    So can you tell me how can i read?

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    What you want to do read, a contact or an image. First of all decide that. Because those things should be done in two ways.

  14. #14
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    What you want to do read, a contact or an image. First of all decide that. Because those things should be done in two ways.
    contact number nothing more

  15. #15
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Okay then you want to access the contacts with an image, and the image need to be transfer as a byte stream. Not as a string or else. But the contact number is possible.

    Check the code body of getPhoto(), can you understand what it is really doing?

  16. #16
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post

    Check the code body of getPhoto(), can you understand what it is really doing?
    No really i don't understand?
    Please help me

  17. #17
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Please help me

  18. #18
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    So, debug that method. And check really what happen there. If you are stuck on anything let me know.

  19. #19
    Blackberrylerner is offline Senior Member
    Join Date
    Jul 2010
    Posts
    101
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    So, debug that method. And check really what happen there. If you are stuck on anything let me know.
    Ok Thanks for reply.I debug this method
    Java Code:
    public byte[] getPhoto() throws IOException
         {
             if( _contact.countValues( Contact.TEL ) > 0 ) {
                 byte[] photoEncoded = _contact.getBinary( Contact.TEL, 0 );
                 return Base64InputStream.decode( photoEncoded, 0,
                         photoEncoded.length );
             } else {
                 return null;
             }
         }
    It's always return null.
    Please help me

  20. #20
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Page 1 of 2 12 LastLast

Similar Threads

  1. How to make a contact form
    By suvojit168 in forum Java Servlet
    Replies: 5
    Last Post: 11-13-2009, 02:49 PM
  2. To access hotmail contact list using java
    By bharat_kasodariya in forum Advanced Java
    Replies: 1
    Last Post: 02-26-2009, 02:06 PM
  3. Replies: 2
    Last Post: 11-21-2008, 08:36 PM
  4. how to contact servlet from clientside through ajax
    By santhoskumara in forum Advanced Java
    Replies: 2
    Last Post: 08-10-2007, 06:56 AM

Posting Permissions

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