[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread Mark Murphy
loty wrote: > Thanks a lot Mark - excellent explanation. > Still have a question: > > getView's first 2 parameters are > --position-- The position of the item within the adapter's data set > of the item whose view we want. > --convertView-- The old view to reuse, if possible. Note: You sho

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread loty
I didn't mean to insult anyone - sorry if it came out that way. Just wanted a clear explanation for what seems to be a weird and unpredictable behavior. On Dec 18, 11:57 am, Mark Murphy wrote: > loty wrote: > > Is this some sort of garbage collection at work here? I have a pile of > > garbage vi

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread Mark Murphy
loty wrote: > Is this some sort of garbage collection at work here? I have a pile of > garbage views to be recycled and hey you need a view - how about this > one? No, you are SOL... > > I mean if getView doesn't bother returning me my original view for a > given location why bother with convertV

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread loty
Is this some sort of garbage collection at work here? I have a pile of garbage views to be recycled and hey you need a view - how about this one? No, you are SOL... I mean if getView doesn't bother returning me my original view for a given location why bother with convertView at all? I guess eith

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread loty
Thanks a lot Mark - excellent explanation. Still have a question: getView's first 2 parameters are --position--The position of the item within the adapter's data set of the item whose view we want. --convertView-- The old view to reuse, if possible. Note: You should check that this vi

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread joshv
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 wrote: > Thanks josh, > I can definitely do the same but it seems super strange to me that it > would

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread joshv
In my adapter code I only ever return a single type of view from getView(). This view always has a field with an id of R.id.name. A non-zero percentage of the time I am given a convertView in the parameters passed to getView() and the code: convertView.findViewById(R.id.name) will return null.

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread Mark Murphy
loty wrote: > 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. getView() gets called more than once. > Is there any rhyme or reason for what this function gets in the > convertView parameter? Sure. It's

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread loty
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

[android-developers] Re: BaseAdapter getView question

2008-12-18 Thread joshv
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 wrote: > I have a question about getView method