RT,有人有思路么,想了想不知道怎么实现,下拉倒还好,上拉看历史消息不知道怎么做。
下拉直接获取最新的消息就成,但是下拉是不是需要客户端上传当前微博的id呢?
巴扎黑2017-04-17 11:18:40
Although I have never done android development, I can give you an idea. There is such an interface in weibo api
statuses/home_timeline
You can select a max_id
parameter when calling it, that is, the id of Weibo cannot be greater than max_id
. When you pull up to refresh Weibo, assuming that the ID of the last Weibo on your phone is 100, then we can call this interface to get the Weibo before this Weibo.
statuses/home_timeline?max_id=99
Just put the results at the bottom of the list~
ringa_lee2017-04-17 11:18:40
At present, our application also perfectly implements the pull-up and pull-down functions, which are implemented on both Android and iOS. This only requires the relevant interfaces to be provided in the background. A maxid and a minid are fine. You can try my product "Fan Texi" or www.ftx.cn
ringa_lee2017-04-17 11:18:40
To implement this function in Android, you can refer to a library on github.
Android-PullToRefresh
The server implements the paging (start, offset) function, and the client only needs to load a certain amount of data each time it requests.