After I hit my head for almost three hours, I was able to solve this. It was quite difficult.
As a result, I created a handler and Runnable that calls mPullRefreshListView.onRefreshComplete(); , and after a while checks that if mPullRefreshListView is still being updated, then call the method again, which closes it the next time it is called. :)
The code is as follows.
@Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { if (hasMoreData()) { // Call service when pulled to refresh toastShort("Last"); orderService(); } else { // Call onRefreshComplete when the list has been // refreshed. toastShort("No more data to load"); upDatePull(); //this method does the trick } } private void upDatePull() { // lvOrders.setAdapter(null); handler = new Handler(); handler.postDelayed(runnable, 1000); } Runnable runnable = new Runnable() { @Override public void run() { mPullRefreshListView.onRefreshComplete(); if (mPullRefreshListView.isRefreshing()) { Logger.d("xxx", "trying to hide refresh"); handler.postDelayed(this, 1000); } } };
Credits to this link.
source share