我有一個意圖,即當GCM (Google Cloud Messenger)
新消息進入時,啓動一個顯示alert dialog
的活動。對話框顯示未讀消息的數量,但如果在已經顯示一條消息之後又有新消息進入,並且沒有查看前一條消息,則對話框應該更新未讀計數以反映新/未讀消息的數量。更新啓動活動的意圖
但是,如果對話框中的活動處於活動狀態,則意圖不會更新對話框,因此我怎麼能更新它,因爲我無法在對話框中調用解除對話框?
如果有新的消息
if((incMsgs + dlMsgs) > 0 && !mMsgType.equals("Reg")){
edit.putBoolean(Preferences.NEW_ALERT, true).commit();
priorityMsgs = true;
Intent i = new Intent(this,NotificationDialog.class);
i.putExtra("incidents", incMsgs);
i.putExtra("dlMessages", dlMsgs);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
}