2012/1/5 John Davis <[email protected]>:
> Nope.
>            for (int i=0;i<numRows;i++) {
>                // If it is the 2nd or 5th item, tag it so that it will be
> displayed in blue.
>                if (i==2 || i==5) {
>                        listCount = adapter.getCount();
>                        count = theList.getCount();
>                        fooView = (View) theList.getItemAtPosition(i);
> //                      fooView.setTag(99);
>                }
>
> i=2, listCount = 6 and count = 6.  The listview stored in theList is
> functional, since it retuns the result provided by getCount.  It is
> also in agreement with the array adapter count.
> theList.getItemAtPositon(5) should either return the item or null.  It
> raises and exception.  That is a bug.

Yes, it is a bug in your code. You are getting a ClassCastException
now, because getItemAtPosition() is not returning a View.

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

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
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

Reply via email to