开发者

BlackBerry - How to refresh the Calendar Event Viewer screen programmatically?

开发者 https://www.devze.com 2022-12-11 05:01 出处:网络
I created a custom menu item inside the Blackberry Calendar Event Viewer which opened another screen.When the screen is closed, something was changed on the event and was committed. However the follow

I created a custom menu item inside the Blackberry Calendar Event Viewer which opened another screen. When the screen is closed, something was changed on the event and was committed. However the following code can not refresh the contents in Event Viewer.

The following code is inside the method onClose() of the screen and is after the closing the screen.

UiApplication.getUiApplication().invokeLater(new Runnable()
{
    public void run()
    {
        try
        {
            event0.setString(Event.NOTE, 0, 
                PIMItem.ATTR_NONE, "blahblan");
            event0.commit();
            //The active screen is Event Viewer. I tested it.
            Screen screen = 
                UiApplication.getUiApplication().getActiveScreen();
            screen.invalidate();
        }
        catch(Exception pexp)
     开发者_高级运维   {
            return;
        }
    }
});

Thanks in advance.


Maybe event is updated only in Event View screen constructor...

Workaround is to close and open Event View screen... using event injections

mEvent.commit();
// The active screen is Event Viewer. I tested it.
Screen screen = UiApplication.getUiApplication().getActiveScreen();
UiApplication.getUiApplication().popScreen(screen);
KeyEvent event = new KeyEvent(KeyEvent.KEY_DOWN, Characters.ENTER,
    KeyListener.STATUS_NOT_FROM_KEYPAD);
event.post();

Don't forget to Allow Application Permission -> Interaction -> Input Simulation.
Or request it pragmatically (How to give blackberry application all the available permission?)

0

精彩评论

暂无评论...
验证码 换一张
取 消