2012/1/5 John Davis <[email protected]>:
> Hello Mark,
>
> 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.
>

Jeeze, how many times do we have to tell you before you listen...
This *is* a bug, a bug you introduced.  You get the item at the
position.  Then you cast it to something it isn't.  You can't do that:
it's not a view, you can't treat it like one.  Why do you think you
can?  Android API returns you back the object perfectly fine, but then
*you* cast it to something it's not, *you're* the one raising the
exception.

Kris

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