Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 42
Registered: ‎12-04-2008
My Device: Not Specified
Accepted Solution

ClassCastException?

When the code below is executed, a ClassCastException will be thrown.

 


ContactList _contactList = (ContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);

Vector _contactVector = enumToVector(_contactList.items());

//enumToVector is a function to transform enum to vector

 

BlackBerryContact contact = (BlackBerryContact)(_contactVector.elementAt(index));

//the exception thrown by this sentence

 


I use almost the same code at some other place,it works well there.But why there is an exception here? Any suggestion will be appreciated.

Developer
Posts: 53
Registered: ‎12-11-2008
My Device: Not Specified

Re: ClassCastException?

Look at the real class name that is stored in vector using debugger.