How to achieve pagination?
I am dealing with huge data (downloading f开发者_如何学运维rom webserver to client/phone). Currently I am trying to parse and load complete data into sqlite database when the application launches.
This is taking a lot of time. I want to load the data based on the screen navigation.
How do I achieve that?
You'll want to pass information between your server and the device as XML.
This way the device can request URLs for specific information such as example.com/news/latest
(return headlines of the latest 20 news articles), example.com/news/americas
(the latest 20 article headlines from the Americas) or example.com/news/article/177309/
(one full article).
The server can then query its database for the needed information based on the query and output it for the client as XML. The client can parse the XML and add the data to it's local SQLiteDatabase.
Is this not restricting the dataset returned from the source first, then downloading it onto the client device?
If you are looking for performance boost up , i prefer running an async task in which the data gets uploaded or downloaded to the server. Its similar to threads but much better.
精彩评论