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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 191
Registered: ‎04-02-2013
My Device: BlackBerry Bold 9900
My Carrier: developer
Accepted Solution

Problem in logic of the program

Hey

 

In my application i have a labelfield which is clickable.

When i click on it another screen gets open and after performing some task the current screen  gets closed and i am moved to the same screen having labelfield.

 

But this time i have changed the name of the labelfield and now when i click on the label field another screen gets open.

 

Suppose this is my screen1 having label as Label1

text1 = "Label1"

label1 = new LabelField(text1,LabelField.FOCUSSABLE)

{

protected boolean navigationClick(int status, int time)
{

if(text1.equals("Label1")

{

UiApplication.getUiApplication.pushScreen(new MyScreen1());

}

else if(text1.equals("Label2"))

{

UiApplication.getUiApplicatio.pushScreen(new MyScreen2());

}

   return true;

}

};

 

In MyScreen1 is am changing the name of Labelfield as Label2.

MyScreen1()

{

Screen1.label1.setText("Label2");

}

 

The problem is when i click on Label1, MyScreen1 gets open and it changes the name of the labelField.

But when i click on Label2 again MyScreen1 gets open

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in logic of the program

You said:

"In MyScreen1 is am changing the name of Labelfield as Label2.

MyScreen1()

{

Screen1.label1.setText("Label2");

}"

 

Then your test:

"if(text1.equals("Label1")"

does not make sense, you need to test the current label, for example:

"if(label1.getText().equals("Label1")"

 

But why bother having screen 1 do this.  You could do this in your originating screen for example:

"if(text1.equals("Label1")

{

text1 = Label2;

label1.setText(text1);

UiApplication.getUiApplication.pushScreen(new MyScreen1());

}"

Developer
Posts: 191
Registered: ‎04-02-2013
My Device: BlackBerry Bold 9900
My Carrier: developer

Re: Problem in logic of the program

[ Edited ]

Thanks for the reply.

 

I will try and then let u know.

Developer
Posts: 191
Registered: ‎04-02-2013
My Device: BlackBerry Bold 9900
My Carrier: developer

Re: Problem in logic of the program

Thanks Peter

I found the solution.