ViewPager, PagerAdapter, and Recycling

PagerAdapter is more general than the adapters used for AdapterViews. Instead of providing a View recycling mechanism directly ViewPager uses callbacks to indicate the steps taken during an update. A PagerAdapter may implement a form of View recycling if desired or use a more sophisticated method of managing page Views such as Fragment transactions where each page is represented by its own Fragment.

As PagerAdapter does not handle view recycling, I tried to make one with an android.widget.Adapter like interface: getCount(), getItem(int position), and getView(Object object, View convertView, ViewGroup parent).

The code is on github https://gist.github.com/4551304.

The view-data binding is queued until finishUpdate instead of getting done in instantiateItem. So no matter destoryItem is called before instantiateItem or not (swiping direction will cause different calling orders), we always have a chance to try recycling the detached views.

Why the middlemen still exist?

Months ago, I kept hearing discussions about greedy academic publishers, and recently the talk of how GDSs (Global Distribution Systems, a.k.a. computerised reservation systems) are devouring airliners is having my attention. Both are accused for taking an unfair share of profit by providing little contribution to any party.

What behind them are peer review system, which is supposed to be a quality stamp, and travel agents, which connects businesses with airliners.

That’s something to disrupt.

Nexus 7 v.s. Amazon

I guess Nexus 7 is eating into Amazon’s pie: not only Kindle Fire, but the whole Kindle family.

It’s rational for consumers: you still get Kindle as an app.

But that’s fine for Amazon: they don’t earn money on Kindle hardware anyway.

UPDATE: no, it matters, taking the payment part under control is vital to Amazon. They had already lost that on iOS.