Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need a page viewer with dynamic pages

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a pageviewer which contain 3 poages.its working fine.I need to improve it to dynamic pages.that mean number of pages depend on the server response.below is the current classes.

pageviewer class


 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What needs to change is that the getItem and getCount need to return data based on whatever the server data indicate. getCount is called too often to obtain the number of pages from the server dynamically, so I suggest to run periodic background calls to the server (maybe once a minute via an AsyncTask) that inquire whether anything has changed, and adjust the local data based on what that call returns.

(I've removed the code of the fragment classes, since they don't matter for the purposes of this question.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic