Load progressive ListView

by arnouf » Mon, 17 Aug 2009 15:40:14 GMT


Sponsored Links
 Hi all,

I've a ListActivity. Data are provided by a Thread calling a URL to
load data from a database. The URL returns data from position x to x
+5 . the x value is sent by my application indicating the position of
the last displayed item.

Now I would like to know, how can I detect when user is on the last
record displayed in my ListView. This can give information to recall
my URL with the new x.

I tried to implement it in my ArrayAdapter.getView() method, testing
the getPosition() and myArray length...It works well but everytime!

This should work like GMail app for example (you have 50 last
discussions loaded by default and if you go down after these 50, a new
loading is done).

What is the good solution?

Big thanks by advance for your help.

Arno

--~--~---------~--~----~------------~-------~--~----~



Load progressive ListView

by Mark Murphy » Mon, 17 Aug 2009 19:55:57 GMT


 


I do not know if it is "good", but this is what I wrote to handle this
situation:

https://github.com/commonsguy/cwac-endless/tree

One of these days, I will cobble together enough time to add more
documentation and a blog post about this...

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

_Android Programming Tutorials_ Version 1.0 In Print!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Google Map is not displaying in emulator

have an odd problem.  I'm working on my first Maps application.  I'm
using the demo/tutorial code as a baseline to figure this out.

I have the app running, I can see the zoom controls....but no map
graphic.

I see no errors in the console.

I've set the debug.keystore.  I also have the key for the API set.
I've verified I have them in the right place according to the Eclipse
configuration.

I can even add an overlay with a small graphic with no problem.

But I still only see the "graph paper"-like background for the map.
I'm not sure what's going on.

Using Java 1.6.

--

2. Specify URL for Uri.parse() in resource file?

I tried creating a string with an id (myurl) and then referring to it
using R.id.myurl in my code but this doesn't work. So how can I
specify a URL in the XML and then retrieve it to use in Uri.parse() ?


--

3. can't write to sdcard anymore

4. Selection

5. How to perform the animation in viewgroup

6. URLSpan string problem

7. Android Dev Phone with Verizon?