0
我是Xamarin和Android的新手。我有一個接收gcm通知的應用程序,所以我需要將此通知傳遞給包含listview的片段。我想在listview中追加這些通知而不用重新打開片段 - 就像whatsapp聊天窗口一樣。我填充ListView這樣的:將GCM消息傳遞給Fragment - Xamarin
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
List<ChatHistory> lstChatHistory = LocalDB.GetChatHistory(db, communityRefNo);
for (int x = 0; x < lstChatHistory.Count; x++)
{
_mySimpleItemLoader.LoadMoreItems(lstChatHistory[x].TyperName, lstChatHistory[x].message, lstChatHistory[x].dateCreated);
ListViewItemsCount++;
}
lvChat.Adapter = new ListViewChatAdapter(this.Context, _mySimpleItemLoader);
}
的GCM接收機方法具有以下參數:
public override void OnMessageReceived(string from, Bundle data)
{
//pass the received info to the listview above without reopening the fragment above
}