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. WebView and scrollTo

I have a WebView rendering content via loadURL. I am trying to
implement a bookmarking system, so I can go back to a given url/y
Position pair. I am attempting to do this via scrollTo. It works if
the page is already loaded, however if it is not loaded yet The
WebView does not scroll. I am sure I am mising something with the
order in which things rendered/etc. Has anyone been able to do this
successfully ?

My code is as follows:

        wv.loadUrl(pageURL);
        //wv.refreshDrawableState();
        wv.scrollTo(0,yPos);
        //wv.invalidate();

-- 

2. android automation testing tools for std android apps and other apps??

Hi all,

Can you suggest automation testing tools for std android apps?

Thanks,
Nency

-- 

3. New ADT available.

4. Remove tabs on click event

5. applying a theme to an appwidget

6. How to handle Home Button

7. Startup App