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
Developer
sickned
Posts: 88
Registered: ‎09-25-2008
My Device: Not Specified
Accepted Solution

ClassCastException at MenuItem

Im saving a MenuItem in an attribute of a object.

 

When later I invoke the run method I get a ClassCastException.

 

Any solution?

 

Thanks.

Please use plain text.
Developer
simon_hain
Posts: 15,876
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: ClassCastException at MenuItem

what is the class of your object when you try to execute it? (sysout getClass() )
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
sickned
Posts: 88
Registered: ‎09-25-2008
My Device: Not Specified

Re: ClassCastException at MenuItem

[ Edited ]

Its a TextField$TogglingMenuItem.

 

Its very strange, but I was doing controller.getSureType().run(); <-- This crashes.

 

But if I do MenuItem suretype = controller.getSureType(); suretype.run() <-- This works!

 

Weird, dont?

 

 

Thanks!

 

Message Edited by sickned on 12-12-2008 07:29 AM
Please use plain text.