[android-developers] Re: position value in getView seems too big

2014-05-19 Thread Streets Of Boston
The ListAdapter's max value of the 'position' parameter of its getView(...) method is determined by the ListAdatper's getCount() method. It will never be larger than the value returned by getCount(): 0 <= position < getCount() I have never seen position being larger or equal than getCount(

[android-developers] Re: position value in getView seems too big

2014-05-19 Thread plnelson
I am calling notifyDataSetChanged(). If I override it in my adapter, to add a log trace, this does get hit and the trace happens . . . > > > > > > *// just overriding notifyDataSetChanged() to instrument it > @Overridepublic void notifyDataSetChanged() {

Re: [android-developers] Re: position value in getView seems too big

2014-05-16 Thread Kostya Vasilyev
The value returned by AdapterView.getCount is cached. https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/AdapterView.java#580 It's also updated after you've called notifyDataSetChanged: https://android.googlesource.com/platform/frameworks/base/

[android-developers] Re: position value in getView seems too big

2014-05-16 Thread plnelson
There's a lot of proprietary code in the adapter; I'll see if I can whittle it down to something simple but meanwhile I'd like to pursue the listview's strange getCount result. Because that's a separate question from the getView()'s position value (maybe) I've started a separate thread focus

[android-developers] Re: position value in getView seems too big

2014-05-16 Thread Streets Of Boston
That is hard to figure out without you posting the code of your adapter and how you create an instance of your adapter. It is probably a subtle bug... On Friday, May 16, 2014 2:34:19 PM UTC-4, plnelson wrote: > > > Sorry - should be lv.get*Count*. > > And yes, I am calling notifyDataSetChanged.

[android-developers] Re: position value in getView seems too big

2014-05-16 Thread plnelson
Sorry - should be lv.get*Count*. And yes, I am calling notifyDataSetChanged. I've also tried calling the ListView's *invalidate()* method, with no change in the behavior. Since posting this I've written a whole separate version of the program where I initially display 12 items ( listItems

[android-developers] Re: position value in getView seems too big

2014-05-15 Thread Streets Of Boston
There is no method 'getView' on a ListView class. And i expect i wouldn't return a number However, you do define a *static *field called *listItems*. Do you update the *listItems *field directly without notifying the your *BaseAdapter*? If so, this could be the problem. Notify the *BaseAdap