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

BlackBerry® World™ Development

Reply
New Contributor
Posts: 7
Registered: ‎01-10-2012
My Device: 9500
Accepted Solution

Fault with 9800 java? .getLabel not working

.getLabel not working on 9800 Hi    im having problems with a button that fires a timer, If i take away all the "if" statements it works fine so there is nothing wrong witht the timer code. This same code works fine in every other phone i have tried 8900, storm, etc its only on the 9800 that it fails and runs to the end of the "if" statements.   is there a change in the .getLabel?   my code is...     startbtn.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field1, int context) { /////sound file try { Manager.playTone(ToneControl.C4, 100, 50); } catch (MediaException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (startbtn.getLabel() == "START"){ startbtn.setLabel("STOP!"); startTimer(); } else if (startbtn.getLabel() == "STOP!"){ startbtn.setLabel("RESET"); stopTimer(); } else if (startbtn.getLabel() == "RESET"){ dismiss(); //// RESET SCREEN AFTER } }});     i hope someone can help i cant find an answer anywhere.
Developer
Posts: 304
Registered: ‎08-01-2008
My Device: Not Specified

Re: Fault with 9800 java? .getLabel not working

Lesson To Learn:

 

NEVER, I mean NEVER, compare strings for equality using the == operator.

 

http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java

New Contributor
Posts: 7
Registered: ‎01-10-2012
My Device: 9500

Re: Fault with 9800 java? .getLabel not working

Thank you so much, I have been looking for an answer for ages... I just didn't ask the correct Question..