4

I am using the old version of Android PullToRefresh library. It works fine for triggering loading when over scrolling.

However, I want to show the loading footer view when I first enter my activity. I tried many times but still cannot find a correct way.

Is there anybody could help me out?

Robin
  • 10,052
  • 6
  • 31
  • 52
  • try to set it to show footer with a delay of 300-500 millis,sometimes it doesn't have enough time to initialise – Eddy Jan 20 '14 at 14:32
  • Thanks! That really works! Please post an answer and I can accept it. – Robin Jan 20 '14 at 14:36

2 Answers2

13

try to set it to show footer with a delay of 300-500 millis,sometimes it doesn't have enough time to initialise

new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            mPullRefreshGridView.setRefreshing(true);
        }
    }, 500);

this solved the problem to me

Eddy
  • 489
  • 4
  • 10
6

Set PullToRefreshListView mode:

<com.handmark.pulltorefresh.library.PullToRefreshListView
ptr:ptrMode="pullFromEnd"
ptr:ptrAnimationStyle="rotate"
/>

call

getRefreshableListView().setRefreshing();

where getRefreshableListView() is your method that finds actual PullToRefreshListView. After initial loading of your data don't forget to call

getRefreshableListView().onRefreshComplete();

if setRefreshing() does not work, try using postDelayed():

getRefreshableListView().postDelayed(new Runnable() { getRefreshableListView().setRefreshing();}, 200);
agamov
  • 4,407
  • 1
  • 27
  • 31