1
votes

I am trying to update the Screen on a event Call back in blackberry application. In the Call back I have written a custom Manager. First I am adding stuff to Screen ie manager when loaded(ie in screen's constructor). Once it is added after some duration I get a callback in which I delete all the fields on the screen and try to add new stuff. Although the deleteAll is working but I am unable to add the new content. I am using below code.

synchronized (UiApplication.getEventLock()) {
        manager.deleteAll();
        RichTextField rich1 = new RichTextField("RichTextField1");
        add(rich1);                
    }

Also tried call to invalidate but no use.

Thanks,

2
You can try updateLayout(), but my guess is there is an underlying problem somewhere else. Also, you are calling manager.deleteAll() and then add() rather than manager.add(), don't know if that matters to the way you have your screen setup - jprofitt
I'd also vote for manager.add() jprofitt points to. - Vit Khudenko
you said that you use custom layout see if you have messed something over there - Dhruv Mevada

2 Answers

0
votes

I would suggest another way:

try to do insert then delete like:

synchronized (UiApplication.getEventLock()) 
    {
        RichTextField rich1 = new RichTextField("RichTextField1");
        manager.insert(rich1,0);   
        manager.deleteAll();    
               or
        manager.delete(field_to_delete);         
    }

Hope it helps.

0
votes

Try this one:

UiApplication.getUiApplication().invokeLater(new Runnable() {
   public void run() {                 
        //Update your field here    
   }
});