title: ListView with a custom adapter, adding elements one by one
body: <p>Reading <a href="https://stackoverflow.com/questions/2130546/android-adding-and-showing-items-to-listview-one-at-a-time-using-an-arrayadapt">this</a> question, I tried the example given in the answer and it's working fine.
  Now I want to do the same but with a custom adapter using a <code>Student</code> class. So I have:</p>
  
  <pre><code>public class AsyncDemo extends ListActivity {
    private static final String[] items={"lorem", "ipsum", "dolor",
                                        "sit", "amet", "consectetuer",
                                        "adipiscing", "elit", "morbi",
                                        "vel", "ligula", "vitae",
                                        "arcu", "aliquet", "mollis",
                                        "etiam", "vel", "erat",
                                        "placerat", "ante",
                                        "porttitor", "sodales",
                                        "pellentesque", "augue",
                                        "purus"};
      private List&lt;Student&gt;  students;
      private StudentAdapter studentsAdapter;
  
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
  //    setListAdapter(new ArrayAdapter&lt;String&gt;(this,
  //                        android.R.layout.simple_list_item_1,
  //                        new ArrayList&lt;String&gt;()));
  
      students = new ArrayList&lt;Student&gt;();
      students.clear();
      studentsAdapter = new StudentAdapter(this, students);
      setListAdapter(studentsAdapter);
  
      new AddStringTask().execute();
      }
  
  //  class AddStringTask extends AsyncTask&lt;Void, String, Void&gt;
      class AddStringTask extends AsyncTask&lt;Void, Student, Void&gt;
      {
      @Override
      protected Void doInBackground(Void... unused)
      {
        for (String item : items)
        {
          Student student = new Student();
          student.setName(item);
          publishProgress(student);
  
  //        publishProgress(item);
  
          SystemClock.sleep(200);
    }
  
    return(null);
  }
  
  //    @SuppressWarnings("unchecked")
  //    @Override
  //    protected void onProgressUpdate(String... item) {
  //      ((ArrayAdapter&lt;String&gt;)getListAdapter()).add(item[0]);
  //    }
      @Override
      protected void onProgressUpdate(Student... student)
      {
        ((StudentAdapter)getListAdapter()).add(student[0]);
      }
  
      @Override
      protected void onPostExecute(Void unused) {
        Toast
          .makeText(AsyncDemo.this, "Done!", Toast.LENGTH_SHORT)
          .show();
      }
    }
  }
  
  
  package com.commonsware.android.async;
  
  public class Student
  {
  private String name;
  
  public void setName(String name) 
    {
    this.name = name;
    }
  public String getName() 
    {
    return name;
    }
  }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>public class StudentAdapter extends BaseAdapter {
      private LayoutInflater inflater;
      private List&lt;Student&gt; students;
      private ViewHolder holder;
  
      public StudentAdapter(Activity context,List&lt;Student&gt; students)
      {
          this.inflater = LayoutInflater.from(context);
          this.students = students;
      }
  
  public void add(Student album)
  {
      Log.w("StudentAdapter","add");
      students.add(album);
  }
  
  @Override
  public int getCount()
  {
      Log.w("StudentAdapter","getCount : " + students.size());
      return students.size();
  }
  
  @Override
  public Object getItem(int position)
  {
      Log.w("StudentAdapter","getItem");
      return students.get(position);
  }
  
  @Override
  public long getItemId(int position)
  {
      Log.w("StudentAdapter","getItemId");
      return position;
  }
  
  private class ViewHolder
  {
      TextView  tv_album_name;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent)
  {
      Log.w("StudentAdapter","getView");
      View rowView = convertView;
  
      if(rowView == null)
      {
          rowView = inflater.inflate(R.layout.student_item,null);
          holder = new ViewHolder();
          holder.tv_album_name = (TextView) rowView.findViewById(R.id.tv_student_name);
          rowView.setTag(holder);
      }
      else
      {
          holder = (ViewHolder) rowView.getTag();
      }
  
      holder.tv_album_name.setText(students.get(position).getName());
  
      return rowView;
  }
  
  }
  </code></pre>
  
  <p>The problem is that only first row is displayed and the <code>Toast</code> after a few seconds. I don't understand why(in the log) there is only one call to <code>getView</code>!
  Is there an error on my code? Something missing? Can someone help me?</p>