title: ListView and items with countdown timer
body: <p>i have a issue with my Listview, i want to set a countdown timer to all ListView's items, and i allready have googled a solution for this, but it isn't work correctly. The Problem is that ListView reuses(recycling) a views, and i always get a wrong item time. I use a tag for my view, but it still not work, i can't understand where i made a mistake, please help me. thx.</p>
  <p>So here a pictures that shows my problem:
  pic1 Where i've just started an Activity;
  <img src="https://i.stack.imgur.com/rYr2y.png" alt="startActivity" /></p>
  <p>pic2 Where i've just scrolled down and up</p>
  <p><img src="https://i.stack.imgur.com/ryJ6K.png" alt="listWithError" /></p>
  <p>And here my code(whole class):</p>
  <h1>UPDATED</h1>
  <pre><code>    public class PromoListActivity extends SherlockActivity {
  private ListView mPromoList;
  private PromoListAdapter mAdapter;
  private ViewFlipper mFlipper;
  private Button mBtnRepeat;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.fragment_news_list);
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      setTitle(&quot;Сохранённые акции&quot;);
      mFlipper = (ViewFlipper) findViewById(R.id.flipper);
      mPromoList = (ListView) findViewById(R.id.newsList);
      mBtnRepeat = (Button) findViewById(R.id.btnRepeat);
      
      //--&gt;
      final Handler timerHandler = new Handler();
      Runnable timerRunnable = new Runnable() {
          @Override
          public void run() {
              mAdapter.notifyDataSetChanged();
              timerHandler.postDelayed(this, 1000); // run every minute
          }
      };
      //&lt;--
      
      
      mBtnRepeat.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
              mFlipper.setDisplayedChild(0);
              getDummyData();
          }
      });
      mPromoList.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) {
              startActivity(new Intent(PromoListActivity.this, PromoActivityDetails.class));
  
          }
      });
      getDummyData();
  }
  
  private class PromoListAdapter extends BaseAdapter {
      private ArrayList&lt;PromoAction&gt; mItems = new ArrayList&lt;PromoAction&gt;();
      private LayoutInflater layoutInflater;
  
      private PromoListAdapter(Context context, ArrayList&lt;PromoAction&gt; mItems) {
          layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          this.mItems = mItems;
      }
  
      public int getCount() {
          return mItems.size();
      }
  
      public PromoAction getItem(int position) {
          return mItems.get(position);
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          ViewItem viewItem;
          PromoAction promoAction = getItem(position);
          if (convertView == null) {
              viewItem = new ViewItem();
              convertView = layoutInflater.inflate(R.layout.listviewitem_action, null);
              viewItem.name = (TextView) convertView.findViewById(R.id.promoAction_name);
              viewItem.desc = (TextView) convertView.findViewById(R.id.promoAction_desc);
              viewItem.timer = (TextView) convertView.findViewById(R.id.promoAction_timer);
              viewItem.timer.setTag(position);
              convertView.setTag(viewItem);
          } else {
              viewItem = (ViewItem) convertView.getTag();
          }
          setTime(promoAction,viewItem.timer,viewItem.timer.getTag().toString());
          viewItem.name.setText(promoAction.name);
          viewItem.desc.setText(promoAction.descr);
          return convertView;
      }
  
      private void setTime(final PromoAction promoAction, final TextView tv, final String tag) {
          if (tv.getTag().toString().equals(tag)) {
              long outputTime = Math.abs(promoAction.timer_end
                      - System.currentTimeMillis());
              Date date = new java.util.Date(outputTime);
              String result = new SimpleDateFormat(&quot;hh:mm:ss&quot;).format(date);
              tv.setText(result);
          }
      }
  
      public class ViewItem {
          TextView name;
          TextView desc;
          TextView timer;
      }
  }
  
  private void getDummyData() {
      ArrayList&lt;PromoAction&gt; list = new ArrayList&lt;PromoAction&gt;();
      for (int i = 1; i &lt; 10; i++) {
          PromoAction action = new PromoAction();
          action.name = &quot;Lorem ipsum dolor sit amet&quot;;
          action.descr = &quot;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. &quot;;
          switch (i) {
          case 1: {
              action.timer_start = 1385971000;
              action.timer_end = 1386104000;
          }
          case 2: {
              action.timer_start = 1385889000;
              action.timer_end = 1385812550;
              break;
          }
          case 3: {
              action.timer_start = 1385884200;
              action.timer_end = 1385912100;
              break;
          }
          default: {
              action.timer_start = 1385856000;
              action.timer_end = 1385892000;
              break;
          }
          }
          list.add(action);
  
      }
      mAdapter = new PromoListAdapter(PromoListActivity.this, list);
      mPromoList.setAdapter(mAdapter);
      mFlipper.setDisplayedChild(1);
  }
  </code></pre>
  <p>}</p>