Blackberry invalidate field not causing a repaint

Posted by Michaela on Stack Overflow See other posts from Stack Overflow or by Michaela
Published on 2010-04-19T22:16:11Z Indexed on 2010/04/20 5:23 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

I'm writing a Blackberry app. I have a custom list field where I can select an item in the list which pushes the edit screen onto the stack. I edit the item and save, and when I pop that screen off so I am back on my list screen, I want to view the update I just made reflected in the list. I have done this on other screens which just had LabelFields and it worked fine. However, with the list screen, calling invalidate() seems to do nothing. I know the value has saved correctly through print lines, and I see the paint() method in the listfield is getting called. But the only way I can get the list field to update is to delete it from the screen and re-add it. That seems wrong. What am I doing wrong?

public class ListTasksScreen extends MainScreen{    
    private TaskList tasks;
    private CustomListField taskListField;

    public ListTasksScreen (TaskList tasks){
        super();
        this.tasks = tasks;     
        Vector incompleteTasks = tasks.getIncompleteTasks();
        taskListField = new CustomListField(incompleteTasks, tasks);
        add(taskListField);     
    }

    public void updateTaskList(TaskList t)
    {
        Vector incompleteTasks = t.getIncompleteTasks();
        taskListField= new TaskListField(incompletetTasks, t);
            //I just want to call taskListField.invalidate() here.
            //the only thing that seems to work is deleting taskListField 
            //and re-adding
            this.delete(taskListField);
        add(taskListField);
    }
}

© Stack Overflow or respective owner

Related posts about blackberry

Related posts about gui