RT,有人有思路么,想了想不知道怎么實現(xiàn),下拉倒還好,上拉看歷史消息不知道怎么做。
下拉直接獲取最新的消息就成,但是下拉是不是需要客戶端上傳當前微博的id呢?
走同樣的路,發(fā)現(xiàn)不同的人生
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~
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
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.