Results 1 to 20 of 24
Thread: contact information
- 08-21-2010, 08:02 AM #1
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
- 08-21-2010, 11:10 AM #2
Senior Member
- Join Date
- Aug 2010
- Posts
- 127
- Rep Power
- 0
What have you tried so far?
- 08-21-2010, 11:14 AM #3
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
- 08-21-2010, 01:37 PM #4
Senior Member
- Join Date
- Aug 2010
- Posts
- 127
- Rep Power
- 0
All java classes from java at:
All Classes (Java 2 Platform SE v1.4.2)
- 08-21-2010, 01:42 PM #5
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
- 08-21-2010, 03:19 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 08-23-2010, 06:05 AM #7
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
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.
- 08-23-2010, 06:17 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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.
- 08-23-2010, 06:28 AM #9
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
I debug code i found where is exception generate.
exception Generate hereJava 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(); } }
getSamplePhoto retun Null.Java Code:private static byte[] getSamplePhoto() { // return the raw bytes of the photo to use return null; }
What i do here i have no idea.Can you tell me what i do here?
Thanks in advance..
- 08-23-2010, 07:41 AM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes, you've return a null from that method. And it cause for the exception.
- 08-23-2010, 07:43 AM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You've to read an image and pass the relevant byte stream, which is not implement yet.
- 08-23-2010, 07:45 AM #12
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
- 08-23-2010, 08:00 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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.
- 08-23-2010, 08:02 AM #14
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
- 08-23-2010, 08:06 AM #15
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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?
- 08-23-2010, 08:18 AM #16
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
- 08-23-2010, 10:01 AM #17
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
Please help me
- 08-27-2010, 06:40 AM #18
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
So, debug that method. And check really what happen there. If you are stuck on anything let me know.
- 08-27-2010, 07:02 AM #19
Senior Member
- Join Date
- Jul 2010
- Posts
- 101
- Rep Power
- 0
Ok Thanks for reply.I debug this method
It's always return null.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; } }
Please help me
- 08-27-2010, 07:19 AM #20
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Think about that lol. Why it returns null, because it fails the following condition.
_contact.countValues( Contact.TEL ) > 0
What it really does?
Similar Threads
-
How to make a contact form
By suvojit168 in forum Java ServletReplies: 5Last Post: 11-13-2009, 02:49 PM -
To access hotmail contact list using java
By bharat_kasodariya in forum Advanced JavaReplies: 1Last Post: 02-26-2009, 02:06 PM -
"connection refused when attempting to contact localhost
By katie in forum New To JavaReplies: 2Last Post: 11-21-2008, 08:36 PM -
how to contact servlet from clientside through ajax
By santhoskumara in forum Advanced JavaReplies: 2Last Post: 08-10-2007, 06:56 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks