0
卡住了MessageList中我嘗試做將MessageList在黑莓使用的MIDlet,但無論我做一些厚望出現。現在我得到NullPointerException。下面是代碼在黑莓
EncodedImage indicatorIcon = EncodedImage.getEncodedImageResource("img/indicator.png");
ApplicationIcon applicationIcon = new ApplicationIcon(indicatorIcon);
ApplicationIndicatorRegistry.getInstance().register(applicationIcon, false, false);
ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
MessageListStore messageStore = MessageListStore.getInstance();
if(reg.getApplicationFolder(INBOX_FOLDER_ID) == null)
{
ApplicationDescriptor daemonDescr = ApplicationDescriptor.currentApplicationDescriptor();
String APPLICATION_NAME = "TestAPP";
ApplicationDescriptor mainDescr = new ApplicationDescriptor(daemonDescr, APPLICATION_NAME, new String[] {});
ApplicationFolderIntegrationConfig inboxIntegration = new ApplicationFolderIntegrationConfig(true, true, mainDescr);
ApplicationFolderIntegrationConfig deletedIntegration = new ApplicationFolderIntegrationConfig(false);
ApplicationMessageFolder inbox = reg.registerFolder(MyApp.INBOX_FOLDER_ID, "Inbox", messageStore.getInboxMessages(),
inboxIntegration);
ApplicationMessageFolder deleted = reg.registerFolder(MyApp.DELETED_FOLDER_ID, "Deleted Messages", messageStore.getDeletedMessages(), deletedIntegration);
messageStore.setFolders(inbox, deleted);
}
DemoMessage message = new DemoMessage();
String name = "John";
message.setSender(name);
message.setSubject("Hello from " + name);
message.setMessage("Hello Chris. This is " + name + ". How are you? Hope to see you at the conference!");
message.setReceivedTime(System.currentTimeMillis());
messageStore.addInboxMessage(message);
messageStore.getInboxFolder().fireElementAdded(message);
有人建議我一個簡單的將MessageList樣品的MIDlet只是顯示字符串在將MessageList和定製ApplicationIndicator值。如果可能,OnClick of消息從後臺返回midlet。
使用此人?我想爲這個代碼中的Midlet給它UiApplication.getUiApplication()。requestForeground(); – aNi
我從來沒有使用這樣的代碼爲midlets。但我不認爲它會有所不同 –
謝謝......它工作 – aNi