I'm new to BB GUI development.
I'm trying to call something as simple as:
Code:
Dialog.alert("Alert!"); as soon as my application starts, from within a main screen that I've defined.
My setup is:
I have an App defined:
Code:
public class MyApp extends UiApplication {
MyModel m_model; // Is the data model
MyView m_view; // Acts as both the view and controller.
public static void main(String[] args) {
MyApp theApp = new MyApp();
theApp.enterEventDispatcher();
}
// App ctor
public MyApp() {
// create model first so it can init before the view asks it for values
m_model = MyModel.getInstance(); // singleton
m_view = new MyView();
// show the main screen.
pushScreen(m_view);
}
} And the MainScreen/View (I've removed much to simplify):
Code:
final class MyView extends MainScreen implements MyResource {
private MyModel m_model;
private ResourceBundle _resources = ResourceBundle.getBundle(BUNDLE_ID, BUNDLE_NAME);
public MyView() {
super();
m_model = MyModel.getInstance();
// ... Init components
LabelField title = new LabelField(_resources.getString(APPLICATION_TITLE), LabelField.ELLIPSIS
| LabelField.USE_ALL_WIDTH);
setTitle(title);
Dialog.alert("Alert!");
}
protected void onDisplay()
{
Dialog.alert("Alert!");
}
} I've tried to call Dialog.alert() from both the constructor and the onDisplay method with the same result.
I get this exception:
"pushModalScreen called by a non-event thread"
Thanks