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
New Developer
calo_11
Posts: 8
Registered: ‎09-17-2008
My Device: Not Specified
Accepted Solution

ClassCastException on TextField

Hi everyone!

 

I've got a problem with a class of mine that extends TextField. When I open the context Menu on MyTextField, the default options appear. If I choose "Show Symbols", my program shows an error that says "ClassCastException". I thought that maybe I had done something wrong with my class, but then y tried the same with a regular TextField and the same problem came up. Anyone knows how I can get that option to work?

Please use plain text.
Administrator
MSohm
Posts: 14,404
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: ClassCastException on TextField

[ Edited ]
Are you creating a MIDlet using javax.microedition.lcdui.TextField or a BlackBerry CLDC application using net.rim.device.api.ui.component.TextField?  Are you seeing this with the base TextField or only with the class you are extending?  What BlackBerry model and handheld software version are you testing with?  You can find this under Options, About on the BlackBerry.
Message Edited by MSohm on 09-23-2008 09:40 AM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
calo_11
Posts: 8
Registered: ‎09-17-2008
My Device: Not Specified

Re: ClassCastException on TextField

 I'm creating a BlackBerry application using net.rim.device.api.ui.component.TextField

The error appears also with the base TextField. I'm using the 8800 Simulator, it says "BlackBerry Device Simulator 2.6.0.49" but i tested my program on another one before (o don't remember which) and the same thing happened.

 

Please use plain text.
Administrator
MSohm
Posts: 14,404
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: ClassCastException on TextField

TextField is the base class for BasicEditField and RichTextField, but can not be instantiated directly.  How are you adding the TextField to your screen?  Can you provide a code snippet that reproduces the exception?

 

The version you have listed is for the BlackBerry Simulation tool itself.  What is the BlackBerry handheld software version running within the tool?  You can see this by going to Options (wrench icon), About within the BlackBerry Simulator.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
calo_11
Posts: 8
Registered: ‎09-17-2008
My Device: Not Specified

Re: ClassCastException on TextField

That's it!!!! I made my class extend BasicEditField instead of TextField and now it's working!!! thank you so much!!
Please use plain text.