• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

need a page viewer with dynamic pages

 
Ranch Hand
Posts: 1325
1
  • 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


 
Rancher
Posts: 43015
76
  • 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.)
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic