1

I am trying to use https://github.com/chrisbanes/ActionBar-PullToRefresh to implement pull-to-refresh. But I don't see where in the example to get data from my server. I am using observer pattern so that inside the update method I can call

mPullToRefresh.setRefreshComplete();

But where do I make the call to server?

By Observer pattern I mean that there is a class SynchDogs responsible for pulling from server. Then this Listview activity registers with SynchDogs as an observer. So where in the Pull-to-refresh pattern to I tell SynchDogs to synch with server? I am using the quick guide as

private void setupPullToRefresh() {
    ActionBarPullToRefresh.from(this)
        .theseChildrenArePullable(R.id.dog_list)
        .listener(this)
        .setup(mPullToRefresh);
}
Katedral Pillon
  • 14,534
  • 25
  • 99
  • 199

1 Answers1

2

you start in the pull-to-refresh listener and then stop via setRefreshComplete when your job is finished

PS: better not use this lib any more https://plus.google.com/103829716466878605055/posts/8wmKAXEGAG2 there is now a SwipeRefreshLayout in the official lib

ligi
  • 39,001
  • 44
  • 144
  • 244
  • Thanks for the link +1 .Even after clicking on `Add Support Library` and choosing version 19, eclipse still can'f find `android.support.v4.widget.SwipeRefreshLayout` for the activity. Do you know how to get it? – Katedral Pillon Mar 29 '14 at 19:20
  • do you know how I might get it? According to `Android SDK Manager` I already have both installed. So I am at a loss on how to get it into my project. – Katedral Pillon Mar 29 '14 at 22:07
  • Thanks for the link, I find the lib. But I am not looking for an example on how to use it. I can't find one yet. I will ask a different question and link it here. – Katedral Pillon Mar 29 '14 at 23:48
  • Here is the link to my new question. can you help? http://stackoverflow.com/questions/22738522/simple-example-on-how-to-use-swiperefreshlayout-with-listview – Katedral Pillon Mar 30 '14 at 00:00