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

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?



Posts: 17,023
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
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
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?





Message Edited by sickned on 12-12-2008 07:29 AM