Notifydatasetchanged Working But Only Showing 1 Result In Listview Android
Hi i have an issue where only 1 result is being shown when i call a notifydataSetChanged function. I have read in this forum that the Array list needs to be cleared, then the data
Solution 1:
What's probably happening is that your list sentMessages
is what you used to initialize your MessageAdapter
, correct? By calling mList.clear()
since it points to the same object as sentMessages
, you are clearing everything from both lists (which is really just the exact same list). What I would do is change your MessageAdapter
constructor to the following:
public MessageAdapter(Activity context, ArrayList<ArrayList<ReadMessage>> list) {
mContext = context;
mList = new ArrayList<ArrayList<ReadMessage>>();
mList.addAll(list);
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
Post a Comment for "Notifydatasetchanged Working But Only Showing 1 Result In Listview Android"