2009-11-14 54 views
0

我在Blackberry日曆事件查看器中創建了一個自定義菜單項,該菜單項打開了另一個屏幕。當屏幕關閉時,事件發生了變化並被提交。但是,以下代碼無法刷新事件查看器中的內容。BlackBerry - 如何以編程方式刷新日曆事件查看器屏幕?

以下代碼位於屏幕的onClose()方法內部,並且是在關閉屏幕之後。

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; 
     } 
    } 
}); 

在此先感謝。

回答

0

也許事件僅在事件查看屏幕構造更新中...

解決方法是關閉和打開事件查看屏幕...使用事件注射

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(); 

不要忘記允許應用權限 - >交互 - >輸入模擬。
或實事求是(How to give blackberry application all the available permission?