title: Android: Multiple simultaneous count-down timers in a ListView
body: <p>I am creating an app that requires a ListView with an undetermined number of elements, each of which has a timer that counts down from a variable number. I am able to successfully make <strong>one</strong> of them count down, but I can't figure out how to include a timer in each element of the ListView.</p>
  
  <p>I am currently using a <a href="http://developer.android.com/reference/android/os/CountDownTimer.html" rel="noreferrer">CountDownTimer</a> (make sure to capitalize the D if copying from the website, they have it wrong).</p>
  
  <p>Any code or sources to point me in the right direction are much appreciated.</p>
  
  <p>Here is my current EventAdapter class, it sets the text displayed in each ListView element's TextView. What I need to do is make the TextView count down every second. Since each element of the ListView is displaying something different, I suppose I need a way of differentiating each element.</p>
  
  <p>I could just update the whole list every second, but there are other elements I have not included such as images loaded from the internet that it would be impractical to refresh every second.</p>
  
  <pre><code>private class EventAdapter extends ArrayAdapter&lt;Event&gt;
  {
      private ArrayList&lt;Event&gt; items;
  
      public EventAdapter(Context context, int textViewResourceId, ArrayList&lt;Event&gt; items) {
          super(context, textViewResourceId, items);
          this.items = items;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View v = convertView;
          if (v == null) {
              LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              v = vi.inflate(R.layout.row, null);
          }
  
          Event e = items.get(position);
  
          if (e != null) {
              TextView tv = (TextView) v.findViewById(R.id.text);
  
              if (tv != null)
                  tv.setText(e.getName());
          }
          return v;
      }
  }
  </code></pre>