avolovoy (4) [Avatar] Offline
#1
Again, small thing, but in the getView in the Adapter
if (convertView == null) {
LayoutInflater inflater =
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

Will be assigned to often for no good reason
I think it gonna be more efficient to cache inflater
in the constructor

LayoutInflater inflater
public DealsAdapter() {
this.section = null;
this.inflater =
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
charlie.collins (125) [Avatar] Offline
#2
Re: 2.7.2 Custom adapters
I agree with this. I'ts minor, especially for a small sample app, but we want to show people the best way to do it. I'll get the code and listing in chapter 2 updated.
thanks
charlie.collins (125) [Avatar] Offline
#3
Re: 2.7.2 Custom adapters
After looking at that a bit more, I don't think it's that bad as is. It only uses the inflater if convertView is null, and that's only going to happen once per instance anyway -- same result as the ctor?