Skip to content Skip to sidebar Skip to footer

Load Earlier Messages In Listview Like Whats App

When i Click load earlier messages the earlier messages get loaded from database but list view scrolls to the top which is not be done , the message should only loaded at the top o

Solution 1:

You just need a view which called "Load more " . And add it as header of list view and on its click fetch the data from database and use notifyDatsetChanged(). thats it .

LayoutInflaterinflater= (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
convertViewHeader = inflater.inflate(R.layout.row_idea_list , null);
convertViewHeader.setBackgroundColor(getResources().getColor(R.color.gray_light_light));

listView.addHeaderView(convertViewHeader, null, false);

Set onclickListener on this convertView and load more data on its click .

Post a Comment for "Load Earlier Messages In Listview Like Whats App"