Exception thrown when I set isFocusable on a blackberry manager
In my blackberry app I have a manager that controls the layout of the fields for my screen. This is the standard way of doing things when you want a custom layout.
Now, one of the "fields" that I'm using is itself a Manager that lays out a series of controls nicely. Call this "field" the "summaryField" as it summarizes data for me. This all renders out nicely.
However, when I override the isFocusable()
member of "summaryField", I start getting a null pointer exception.
Anyone have an idea of why this exception is being thrown?
public class SummaryField extends Manager
{
protected void drawFocus(Graphics graphics, boolean on) {
super.drawFocus(graphics, on);
}
protected void onFocus(int direction) {
super.onFocus(direction);
开发者_如何学Go}
protected void onUnfocus() {
super.onUnfocus();
}
public boolean isFocusable() {
return true;
}
}
If I had to guess, I'd say that your Manager probably doesn't contain any focusable fields in it, and therefore your hardcoded "true" return value for isFocusable() is lying about the true state of the SummaryField. Remember that Managers themselves can't have "focus", just the fields within it.
精彩评论