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
}