06-24-2010 07:27 AM
Hello Guys,
Plz tell me that,
How can i call a another screen form One screen On clicking a Button.
Solved! Go to Solution.
06-24-2010 07:31 AM
you display a screen using UiApplication.getUiApplication().pushScreen(newScr
you can create a button using CONSUME_CLICK and react using a fieldchangelistener, or you can handle navigationclick etc.
06-24-2010 08:33 AM
And since you are a beginner, here's a sample code of what Simon described above (not compiled or tested but should give you an idea)
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class FirstScreen extends MainScreen implements FieldChangeListener {
ButtonField theButton;
public FirstScreen() {
add(new LabelField("First Screen"));
theButton = new ButtonField("New Screen", ButtonField.CONSUME_CLICK);
theButton.setChangeListener(this);
add(theButton);
}
public void fieldChanged(Field field, int context) {
if (field == theButton) {
UiApplication.getUiApplication().pushScreen(new SecondScreen());
}
}
public class SecondScreen extends MainScreen {
public SecondScreen() {
add(new LabelField("Second Screen"));
}
}
}
06-25-2010 03:10 AM
Thank u TobiasReaper,
My Problem is Solved.
06-25-2010 07:19 PM
Glad to be of assistance mate. Enjoy coding. ![]()
12-05-2010 11:11 PM
Perfect, thanks for the code example!
02-26-2011 02:30 AM
thanks i use ur code and i solve my problem
and i also click on kudo of u
04-14-2012 11:32 PM
Hello Sir ,
I came accross your code and tried to run it on the 9900 simulator and for some reason it doesnt pick up the code. as in the application does not appear on the main menu screen so i can not launch it at all.
do you no why.. id really appriciate the help
04-15-2012 08:09 PM
As previously suggested, don't post on Solved Threads, start you own Thread. And can I also suggest that you don't make multiple posts for the same problem.
As far as I can tell, your problem has been solved too: