Reputation: 179
I saw getView implementations that used convertView parameter directly:
if(convertView!=null)
...
return convertView
Another implementations call super.getView:
View view = super.getView( position, convertView, parent );
if(view!=null)
...
return view
My question is, What is the right method?
Upvotes: 0
Views: 2535
Reputation: 10242
I guess you are talking about Adapter.getView(). Which adapter are you extending?
Most adapters have no implementation of getView() themselves and expect that you check if convertView is null before inflating a view one yourself.
I say most adapters since there are exceptions. If you sub-class an Adapter from a third party -lib the adapter might actually provide an implementation of getView() and handle the view recycling. In that case you really should call the super-class.
Also, if you take a look at the code for CursorAdapter it actually has an implementation of getView()
Upvotes: 1