Skip to content Skip to sidebar Skip to footer

Android Adapter Getview Method: Call Super.getview Or Not?

I saw getView implementations that used convertView parameter directly: if(convertView!=null) ... return convertView Another implementations call super.getView: View view = su

Solution 1:

the super.getView( position, convertView, parent ); is unsefull since the super does nothing.

getView belongs to the Adapter interface.

here you can find the code

Solution 2:

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()

Post a Comment for "Android Adapter Getview Method: Call Super.getview Or Not?"