I'm fairly new to writing BlackBerry applications, so maybe this is a stupid thing I'm overlooking. I have to use JDE 5 (client requirement) to support the older BlackBerry Curve 8520 phones.
What I am experiencing is that as soon as I place a DateField on my interface, the application slows down considerably, causing the UI to stutter. Even a simple layout that only has a single DateField and a button has the same effect. Then, as soon as I move on to the next layout, everything is fine again.
One of the layouts are created as follows (please comment if this is the incorrect way of doing it):
public void displaySomeLayout() {
final ButtonField okButton = new ButtonField("OK");
final DateField dobField = new DateField("Birthday", System.currentTimeMillis(), DateField.DATE);
/* some other non-ui code */
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
applicationFieldManager.addAll(new Field[] {
dobField,
okButton
});
}
});
}
The application then just slows down a lot. Sometimes, after a minute of so it starts responding normally again, sometimes not.
The displaySomeLayout() method is called from the contructor of the Screen extending class. And then applicationFieldManager is a private VerticalFieldManager which is instantiated during class construction.
Screensubclass, maybe? And what doesmethodToGetObjectArray()return? Does it return many, many objects, or just a few? - NatemethodToGetObjectArray()returns about 250 elements, but I have found that the phone handles it just fine. It's as soon as theDateFieldgets added that things go slow. - Nico HuysamenObjectChoiceFieldor theDateFieldcauses the problem. If theObjectChoiceFieldis not the problem, please don't show us that code. Show us the code that is the problem, as you see it. Also, you still didn't really answer the question regarding where the code you show is run. Finally, 250 choices is actually a lot. That sounds like a UI that users will hate to scroll through. Is 250 really necessary? - Nate