diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-02 16:33:34 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-02 16:33:34 +0100 |
commit | bbdaf5b0bd7c42729aeba12f3b4ea4cabc794c4f (patch) | |
tree | c3ce3d69b53ce28da4967a5e5a3b3e1f9d8d036b /src/de/gultsch/chat/ui/ConversationFragment.java | |
parent | d365bbe480bdd26a042b425c45227785ab4fbf51 (diff) |
will update messages on conversation update as well
Diffstat (limited to 'src/de/gultsch/chat/ui/ConversationFragment.java')
-rw-r--r-- | src/de/gultsch/chat/ui/ConversationFragment.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/de/gultsch/chat/ui/ConversationFragment.java b/src/de/gultsch/chat/ui/ConversationFragment.java index b8edcbaf..d6398c82 100644 --- a/src/de/gultsch/chat/ui/ConversationFragment.java +++ b/src/de/gultsch/chat/ui/ConversationFragment.java @@ -31,7 +31,8 @@ public class ConversationFragment extends Fragment { protected ListView messagesView; protected LayoutInflater inflater; protected List<Message> messageList = new ArrayList<Message>(); - + protected ArrayAdapter<Message> messageListAdapter; + @Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -76,7 +77,7 @@ public class ConversationFragment extends Fragment { mProfileCursor.moveToFirst(); final Uri profilePicture = Uri.parse(mProfileCursor.getString(1)); - messagesView.setAdapter(new ArrayAdapter<Message>(this.getActivity() + messageListAdapter = new ArrayAdapter<Message>(this.getActivity() .getApplicationContext(), R.layout.message_sent, this.messageList) { private static final int SENT = 0; @@ -134,7 +135,8 @@ public class ConversationFragment extends Fragment { } return view; } - }); + }; + messagesView.setAdapter(messageListAdapter); return view; } @@ -180,4 +182,10 @@ public class ConversationFragment extends Fragment { activity.invalidateOptionsMenu(); } } + + public void updateMessages() { + this.messageList.clear(); + this.messageList.addAll(this.conversation.getMessages()); + this.messageListAdapter.notifyDataSetChanged(); + } } |