Hello,

This is a two part post.  First part, if it is a bug, where do I
report bugs?  Second part, is the behavior I'm observing.

1.  GridView has method to set its internal Adapter.
2.  Derive a new adapter from BaseAdapter, override method getView
(int,View,ViewGroup)
3.  In getView method, put code to instantiate a View grid element
that is displayed on the grid.
Use the samples that are part of the android SDK, ie

if (convertView == null) {
    // create the view
} else {
    // cast the view element
}

return the View;

4.  Create a local array in the Adapter so you can save a pointer to
each one of the elements you created in the getView method mentioned
above for later use.
5.  Notice through a debugger, GridView goes through 1 -> N, (+1)
elements during initialization.
For example, if I have 5 elements in the array of the Adapter, the
getView method will be called as such:
getView(0,...) where 0 is the position, null 2nd arg
getview(1,...)
getview(2,...)
getview(3,...)
getview(4,...)
getview(0,...)    <-- one too many.  Doesn't maintain pointer to this
View, 2nd arg still null

This would be ok, but GridView still maintains a pointer to the
original element (View) created the very first time for position
Zero.  If I don't handle this correctly, I lose the pointer to the
first element, and so I can't manipulate the View.  So I have a
special case to handle the fact I get an extra call with position 0
coming in and the second element being null.

I don't think this is normal behavior and it looks like GridView's
initialization loop is flawed.  I don't know, please help me
understand if I'm wrong.  In the meantime, I'll try to dig around the
source.

thanks in advance,

K



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