Reputation: 144
I have implemented list view from following link.
Requirement
Now i want to add load more button below list and when user will click on button then more record will append to list view.
Problem
For this i have explored stack overflow and other websites and seen examples but i could not got anything relevant to solution of my problem because my knowledge is limited in android as i just started few days ago.
so can you please provide me guidance or any reference link or any example code according to code i have done so that i can solve my problem?
Thanks in advance for your precious time.
Following code demanded by Little Child
public static void addNewData(ArrayList<SearchResults> jobs) {
SearchResults sr1 = new SearchResults();
sr1.setJobTitle("Test job1");
sr1.setJobPostedDate("2014-12-13");
sr1.setJobSkills("php,mysql");
jobs.add(sr1);
sr1 = new SearchResults();
sr1.setJobTitle("Test job2");
sr1.setJobPostedDate("2014-12-13");
sr1.setJobSkills("php,mysql");
jobs.add(sr1);
sr1 = new SearchResults();
sr1.setJobTitle("Test job3");
sr1.setJobPostedDate("2014-12-13");
sr1.setJobSkills("php,mysql");
jobs.add(sr1);
notifyDataSetChanged();
}
Upvotes: 0
Views: 140
Reputation: 25018
The solution is quite simple.
You have some backing data that the ListView
displays via an adapter. Whenever the user click the "Load More" button, load some more data and call adapter.notifyDataSetChanged()
.
That's it.
Upvotes: 2