0
我目前正在开发黑莓应用程序。该场景是当用户点击菜单项时,它将转到另一个页面。目前有3个类,MyApp,SecondPage和MyScreen。下面的代码属于第二页。在黑莓切换页面/类
从MyApp,我想在用户点击一个MenuItem后推屏幕到第二页,但我无法这样做,因为它(第二页)扩展UiApplication我是吧?但如果我改变它来扩展MainScreen,它不能pushScreen(_screen)。有什么建议吗?
感谢, 亨德
class MyApp extends UiApplication{
//creating a member variable for the MainScreen
MainScreen _screen= new MainScreen();
//string variables to store the values of the XML document
String _node,_element;
Connection _connectionthread;
public static void main(String arg[]){
MyApp application = new MyApp();
//create a new instance of the application
//and start the application on the event thread
application.enterEventDispatcher();
}
public MyApp() {
_screen.setTitle("Agenda");//setting title
//_screen.add(new RichTextField("Requesting....."));
_screen.add(new SeparatorField());
pushScreen(_screen); // creating a screen
//creating a connection thread to run in the background
_connectionthread = new Connection();
_connectionthread.start();//starting the thread operation
}
public void updateField(String node, String element)
{
synchronized (UiApplication.getEventLock())
{
String title = "My App";
_screen.add(new RichTextField(/*node + " : " +*/ element + "\n"));
if (node.equals(title))
{
_screen.add(new SeparatorField());
}
}
}