I am writing a custom adapter for ListView which extends BaseAdapter and in this method
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
if (vi == null)
vi = inflater.inflate(R.layout.x, null);
}
why is the check if(vi==null)
performed. getView()
is called for row when it comes in the visible area of the screen. So vi
will be null
everytime getview()
is called? So why is the check necessary here.?
P.S. I was getting some problem on coloring some specific rows of the listview, but when i removed this check, everything works fine. Thats why i am wondering over its usefullness.