我正在尝试使用 https://github.com/chrisbanes/ActionBar-PullToRefresh实现下拉刷新。但是我看不到示例中从我的服务器获取数据的位置。我正在使用观察者模式,以便在 update
方法中我可以调用
mPullToRefresh.setRefreshComplete();
但是我在哪里调用服务器呢?
我所说的观察者模式是指有一个类 SynchDogs 负责从服务器拉取数据。然后这个 Listview Activity 作为观察者向 SynchDogs 注册。那么我在下拉刷新模式中的哪个位置告诉 SynchDogs 与服务器同步?我正在使用快速指南作为
private void setupPullToRefresh() {
ActionBarPullToRefresh.from(this)
.theseChildrenArePullable(R.id.dog_list)
.listener(this)
.setup(mPullToRefresh);
}
最佳答案
您从下拉刷新监听器开始,然后在作业完成时通过 setRefreshComplete 停止
PS:最好不要再使用这个库了https://plus.google.com/103829716466878605055/posts/8wmKAXEGAG2 官方lib中现在有一个SwipeRefreshLayout
关于android - https ://github. com/chrisbanes/ActionBar-PullToRefresh 从服务器拉取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22733987/