1

Possible Duplicate:
ViewPager PagerAdapter not updating the View

I'm new to Android. The first thing I've decided to do is Calendar. I want to display one day's events loaded from Database on each screen (via GridView component). Sliding left is previous day's events. Sliding right is next day' events.

I've looked for some examples of pagers, such as RealViewSwitcher or Deezapps-widget, but they are all have definite number of screens. But I have potencially indefinite number of screens. Also I tried to use only 3 fixed screens and to change their contents while sliding, but this leads to blinking, because after sliding is finished, I change the adapter for gridview and it refreshes contents. For example, I slide to the right and change left screen's gridview adapter from "yesterday" to "today", central screen's gridview adapter from "today" to "tomorrow" and right screen's gridview adapter from "tomorrow" to "day after tomorrow". This approach works fine, but refreshing contents after chaging adapter is not good!

Any ideas about how to adapt one of this pagers to indefinite number of screens?

Community
  • 1
  • 1
AHTOH
  • 446
  • 4
  • 16
  • Found solution in nice application at Google Play - Android UI Patterns, which demonstrates different UI tricks – AHTOH Apr 05 '12 at 10:25

2 Answers2

0

You could try using a Gallery and setting each view of the gallery to match_parent

Pasquale Anatriello
  • 2,355
  • 1
  • 16
  • 16
  • I read there are some problems putting any interactive controls within gallery. So I refused to use it – AHTOH Apr 02 '12 at 07:58
0

Have a look here: Endless Pager. It extends the PagerAdapter class and implements the OnPageChangeListener interface and can be used with the ViewPager widget (all this components are in the support library). It creates a loading element every time the page end is reached or a footer element if there are no more pages.

futtetennista
  • 1,876
  • 1
  • 20
  • 33
  • This example provides endless scrolling up/down which is suitable for lists, but I need left/right. – AHTOH Apr 02 '12 at 09:44
  • From what exactly have you inferred that this is used for lists? This can be used with the standard `ViewPager` widget (which sounds like exactly what you are looking for). – futtetennista Apr 02 '12 at 12:54