Android/Java Beginner: Overriding ArrayAdapter's getView

Posted by Preformed Cone on Stack Overflow See other posts from Stack Overflow or by Preformed Cone
Published on 2010-04-09T01:55:23Z Indexed on 2010/04/09 2:03 UTC
Read the original article Hit count: 363

Filed under:

Firstly I am new to android and Java so this is a beginners question.

I have some code that overrides the ArrayAdapter's getView method. Here is the code

public View getView(int position, View convertView, ViewGroup parent) {
   TextView label = (TextView)convertView;
   if (convertView == null) {
      convertView = new TextView(ctxt);
      label = (TextView)convertView;
   }
   label.setText(items[position]);
   return (convertView);
}

My question is: why does label.setText(items[position]); affect the convertView return value? How are they related / linked?

© Stack Overflow or respective owner

Related posts about android