Our test application does not actually connect to the network but simulates
the slow data source. If you check the Datasource class, you will find that
even though this "data source" is a simple array, the accessor method adds
a 500 ms delay to every access. This simulates well the fact that loading
from certain data sources takes time. The trick is in the PageAdapter class.
This class adds a View to the end of the list ("Loading ..."). Android Market
animates this view but the idea is the same. Whenever this View is drawn,
the adapter kicks the loading thread which progressively fetches new elements
from the data source, adds them to the Adapter's data set and notifies the
adapter that the data set has changed. There is the usual fiddling with
a Handler to make sure that notifyDataSetChanged() is invoked in the context
of the UI thread. The Adapter constantly changes the value returned by the
getCount() method as the items are loaded from the data source. When the
whole data set is loaded, the "Loading ..." widget is not drawn anymore
therefore nothing triggers the loading thread.
Here is how it looks like.

No, wait a minute, here is how it looks like.

Yes! After having blogged for more than 2 years about Android, I finally
put my hands on an actual Android phone. The story is complicated but the
essence is that a friend thought that I deserved that phone and gave it
to me. Thanks for everyone involved!
Subscribe to this Feed


How to use custom de...
lets say i change this app to days to...
How to display a JPG...
Is that posible to zoom in and drag p...
Making a custom Andr...
Cool - I will use it carefully i promise
How to display a JPG...
problem in image loading - i have exe...
Introducing Calculon...
Thank You for your contribution - Hi,...