It makes no sense to me either - I *always* return the same type of
view from getView so I have no idea why the framework would ever send
me a view of a different type.

On Dec 18, 10:11 am, loty <[email protected]> wrote:
> Thanks josh,
> I can definitely do the same but it seems super strange to me that it
> would return anything other than what I created in the initial call.
> Is there any rhyme or reason for what this function gets in the
> convertView parameter?
>
> Here what Android docs say
> --convertView--         The old view to reuse, if possible. Note: You should
> check that this view is non-null and of an appropriate type before
> using. If it is not possible to convert this view to display the
> correct data, this method can create a new view.
>
> Very very mysterious explanation - we'll send you a view and it may or
> may not be the right view. You may or may not use it.
>
> I don't know what google dudes were smoking but I would like to know
> where they get the good stuff.
>
> On Dec 18, 10:37 am, joshv <[email protected]> wrote:
>
> > In my adapter code I take the convertView supplied, if not null, and
> > then attempt to do a findViewById for a field I know should be in the
> > view.  If it's there, I use the view, if it's not, I recreate the view
> > from scratch.
>
> > On Dec 18, 8:45 am, loty <[email protected]> wrote:
>
> > > I have a question about getView method of BaseAdapter that I overwrote
> > > to populate my GridView. All is well when convertView parameter is
> > > null - I create my views for cells and populate them, works and looks
> > > great.
> > > The problem is when my data is updated and notifyDataSetChanged(); is
> > > called somewhere else in my app convertView parameters in getView are
> > > all screwed up.
> > > Here is an example. I created Button view for position 0 and the rest
> > > TextViews. When I get getView calls with convertView not null for
> > > position 0 it's not a Button that I created but a TextView - WTF? For
> > > now I just ignore convertView parameter and always create new views
> > > but clearly either I don't understand something here or it's a bug. I
> > > hope it's me.
--~--~---------~--~----~------------~-------~--~----~
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