I load about 25 items into an ArrayList and I set up the adapter as necessary. I was wondering, is there a way to load each item in the array list 4(or 5 at a time). How would I go about executing this for a regular listview? What I don't want to do is load more from a database I just want to do more operations on what I got from the query. I tried this as reference, but I don't fully think this would apply since I need a listview, not a recycler view.
Here's some sample code of what I think I should be doing:
public class StartEsole extends FragmentActivity implements OnMapReadyCallback, LocationListener {
ListView listview;
ArrayList<Details> businessList = new ArrayList<>();
aggregateTaskBars taskBars;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
listview = (ListView) findViewById(R.id.whatsLit);
mySwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);
mySwipeRefreshLayout.setRefreshing(true);
taskBars = new aggregateTaskBars();
taskBars.execute();
//How would I set it to only 5 items and scroll to bottom and load 5 more
listview.scrollToBottom( add 5 more items from businesslist and populate them into listview)
mySwipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Log.i("AppInfo", "onRefresh called from SwipeRefreshLayout");
lookForWhatsLit();
}
}
);
}
public class aggregateTaskBars extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
//Populate items into Arraylist businessList that contains details of some kind
//should produce 20
return null
}
protected void onPostExecute(String s) {
super.onPostExecute(s);
mySwipeRefreshLayout.setRefreshing(false);
listview.setAdapter(vDetailAdapter);
vDetailAdapter.notifyDataSetChanged();
valueType.setEnabled(true);
}
}