https://github.com/chrisbanes/ActionBar-PullToRefresh从服务器拉取

时间:2014-03-29 16:58:28

标签: android android-layout pull-to-refresh

我正在尝试使用https://github.com/chrisbanes/ActionBar-PullToRefresh来实现pull-to-refresh。但我没有看到示例中从我的服务器获取数据的位置。我正在使用观察者模式,以便在update方法中我可以调用

mPullToRefresh.setRefreshComplete();

但是我在哪里拨打服务器?

按Observer模式我的意思是有一个类SynchDogs负责从服务器中提取。然后,此Listview活动将作为观察者注册到SynchDogs。那么在Pull-to-refresh模式中我告诉SynchDogs与服务器同步?我正在使用快速指南

private void setupPullToRefresh() {
    ActionBarPullToRefresh.from(this)
        .theseChildrenArePullable(R.id.dog_list)
        .listener(this)
        .setup(mPullToRefresh);
}

1 个答案:

答案 0 :(得分:2)

从拉动刷新监听器开始,然后在作业完成时通过setRefreshComplete停止

PS:最好不要再使用这个lib https://plus.google.com/103829716466878605055/posts/8wmKAXEGAG2 现在官方lib中有一个SwipeRefreshLayout