Instead of adding new data to adapter items try getting a reference to your data list from adapter and add this data into it for ex:
private class StreamAdapter extends ArrayAdapter {
private ArrayList<Message> dataList;
public StreamAdapter(Context context, int textViewResourceId, ArrayList<Message> dataList)
{
super(context,textViewResourceId, dataList);
this.dataList=dataList;
}
public ArrayList<Message> getDataList(){
return dataList;
}
public void setDataList(ArrayList<Message> dataList){
this.dataList=dataList;
}
...
...
}
And in when you update it
private void DisplayData() {
// If the request was successfull then notify the adapter to display the data
if(success) {
ArrayList<Message> temp = dataAdapter.getDataList();
for(int i = 0; i < dataList.size(); i++)
{
temp.add(i,dataList.get(i));
}
dataAdapter.notifyDataSetChanged();
}
}
This should work, try it and let me know.
Also override following function inside adapter
@Override
public int getCount() {
return dataList.size();
}
EDIT
private void DisplayData() {
// If the request was successfull then notify the adapter to display the data
if(success) {
ArrayList<Message> temp = dataAdapter.getDataList();
dataList.addAll(temp);
dataAdapter.setDataList(dataList);
dataAdapter.notifyDataSetChanged();
}
}
EDIT 2
private void DisplayData() {
// If the request was successfull then notify the adapter to display the data
if(success) {
ArrayList<Message> temp = dataAdapter.getDataList();
temp.addAll(dataList);
dataAdapter.notifyDataSetChanged();
}
}