【发布时间】:2012-01-17 10:30:16
【问题描述】:
这是我的 uiapplication 类:
public class HelloWorld extends UiApplication {
public HelloWorld(){
pushScreen(new LoadingScreen());
Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_PORTRAIT);
}
public static void main(String[] args){
HelloWorld theapp = new HelloWorld();
theapp.enterEventDispatcher();
}
}
loadingScreen 类:
public class LoadingScreen extends CustomMainScreen {
public LoadingScreen(){
Bitmap tcalogo = Bitmap.getBitmapResource("loading_360.png");
BitmapField tcalogoField = new BitmapField(tcalogo);
add(tcalogoField);
startLoading();
}
public void startLoading(){
ConsumeFactoryThread consumption = new ConsumeFactoryThread("http://example.com",this); //add arguments of url and scope
consumption.start();
}
public void onFinish(JSONArray array){ //method that executes when the json is retrieved
UiApplication.getUiApplication().pushScreen(new FeaturedScreen(array));
}
}
我推送一个加载屏幕,它打开一个线程,下载 json,然后在 loadingScreen 方法中运行 onFinish 方法,并推送一个带有检索到的信息的新屏幕。它工作,线程/下载不是我的问题,但它是用户按下并返回到 loadingScreen 的能力。我得到了这种从堆栈加载的方式,但我不确定它是否是“正确”的方式。
如何使用 loadingScreen 一次?
【问题讨论】:
标签: blackberry