views:

105

answers:

0

In my custom field in a BlackBerry CLDC Application, I want to display a specific context menu based on the current state of the field.

My original idea was to do something like this:

protected void makeContextMenu(ContextMenu contextMenu) {
    if (isPaused()) contextMenu.addItem(resumeMenuItem);
    else contextMenu.addItem(pauseMenuItem);
}

However, the state of the field doesn't seem to be affecting the items on the context menu. I'm assuming that the context menu only gets "made" once during the life of the field.

Is there a way to do what I'm trying to do?

Edit: My thoughts were correct, makeContextMenu is called whenever the context menu is displayed, and the code I wrote above does work. My logic for isPaused() was incorrect!