In custom adapter what is converView parameter in getView() function?
public View getView(int position,
View convertView, ViewGroup parent)
It contains information about which view user has clicked in the adapterview.
it will be null if android is returning previous view which was created and went out of scope for reuse.
it will be not null if android is returning previous view which was created and went out of scope, for reuse.
it is for backward compatibility, it will be always null.
getView function has to create view for each row for adapterview and return it. But at a given point of time only few rows or elements of an adapterview will be visible to user. So it is unnecessary to create all the views if it is not visible to user. Rather we can reuse the old views which went out of scope. In order to reuse the previously created rows/ view which are currently not visible to user, they will be passed as second parameter to this function to reuse those views.
Programmer can check if(convertView != null) , then he or she can reuse that view.
Back To Top