views:

46

answers:

1

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);
    }
    protected void onUnfocus() {
        super.onUnfocus();
    }


    public boolean isFocusable() {
        return true;
    }
}
+1  A: 

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.

Marc Novakowski
That seems to have done the trick. It would be nice if the Manager documentation spelled that out.
yamspog