Ejemplo n.º 1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    CityItemViewHolder holder;

    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.item_city, null);
      holder = new CityItemViewHolder();

      holder.itemName = (TextView) convertView.findViewById(R.id.city_textview_name);
      convertView.setTag(holder);
    } else {
      holder = (CityItemViewHolder) convertView.getTag();
    }

    Long itemId = mDataManager.getCityItemIdList().get(position);
    Log.e("Adapter", "pos = " + position + " itemId = " + itemId);

    CityData item = mDataManager.getCityItems(itemId);
    if (null != item) {
      holder.itemName.setText(item.getCityName());
    }
    return convertView;
  }
Ejemplo n.º 2
0
 @Override
 public int getCount() {
   int size = mDataManager.getCityItemIdList().size();
   Log.e(TAG, "size = " + size);
   return size;
 }