"getView method checking if the position is the last one": When the getView is called repeatedly to populate the list with views, it is not guaranteed that the value of parameter 'position' is going to be 1, 2, 3, ... , n in sequence. In other words, the statement "if position is the last item in the list then the user is at the bottom of the list" is not guaranteed to be always true.
On Aug 18, 6:20 pm, Mark Murphy <[email protected]> wrote: > devstudent wrote: > > What would be the best way to accomplish this with the Efficient > > Adapter example? My implementation involves the getView method. I > > check if the current position is the last row, and return a new View. > > I then use View.setId() to signify that this View is the loading row. > > Then when I attempt to re-use the convertView I check this ID to make > > sure I re-use the correct type of View. Is there a faster way? > > > Romain Guy mentioned that the Android Market app used OnScrollListener > > to detect when the last element was on screen. Why is this better than > > in the getView method checking if the position is the last one? > > I haven't tried the OnScrollListener trick. My approach was to create a > wrapping adapter that handles this sort of "loading" behavior: > > https://github.com/commonsguy/cwac-endless/tree > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android App Developer Books:http://commonsware.com/books.html --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

