DataSource.java :  » App » appsorganizer » com » google » code » appsorganizer » prova » Android Open Source

Android Open Source » App » appsorganizer 
appsorganizer » com » google » code » appsorganizer » prova » DataSource.java
package com.google.code.appsorganizer.prova;

import java.util.ArrayList;

public class DataSource {
  static final int ITEM_COUNT = 100;
  ArrayList<String> items;

  public DataSource() {
    items = new ArrayList<String>(ITEM_COUNT);
    for (int i = 0; i < ITEM_COUNT; ++i) {
      items.add("item" + Integer.toString(i));
    }
  }

  public int getItemCount() {
    return items.size();
  }

  public String getItem(int itemIndex) {
    // It's a slow data source
    try {
      Thread.sleep(500L);
    } catch (InterruptedException ex) {
    }
    return items.get(itemIndex);
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.