Beispiel #1
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      ViewHolder holder;
      if (convertView == null) {
        LayoutInflater mInflater =
            (LayoutInflater) mCon.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        convertView = mInflater.inflate(R.layout.tvback_item, parent, false);

        holder = new ViewHolder();
        holder.iv = (ImageView) convertView.findViewById(R.id.tvback_item_image);
        holder.tv = (TextView) convertView.findViewById(R.id.tvback_item_name);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      Object obj = mListItem.get(position).get(KeyEnum.poster.toString());
      if (obj != null) {
        String poster = obj.toString();
        if (!ValidateUtil.isBlank(poster) && holder.iv != null) {
          downloader.download(poster, holder.iv);
        }
      } else {
        Log.w(TAG, "no poster idex=" + position);
      }

      obj = mListItem.get(position).get(KeyEnum.name.toString());
      if (obj != null) {
        holder.tv.setText(obj.toString());
      } else {
        holder.tv.setText("");
        Log.w(TAG, "no name idex=" + position);
      }

      return convertView;
    }
Beispiel #2
0
  private class TvBackChannelAdapter extends BaseAdapter {
    private Context mCon;
    private ImageDownloader downloader = ImageDownloader.getImageDownloader();

    private class ViewHolder {
      ImageView iv;
      TextView tv;
    }

    public TvBackChannelAdapter(Context c) {
      mCon = c;
    }

    @Override
    public int getCount() {
      // TODO Auto-generated method stub
      return mListItem.size();
    }

    @Override
    public Object getItem(int arg0) {
      // TODO Auto-generated method stub
      return arg0;
    }

    @Override
    public long getItemId(int arg0) {
      // TODO Auto-generated method stub
      return arg0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      ViewHolder holder;
      if (convertView == null) {
        LayoutInflater mInflater =
            (LayoutInflater) mCon.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        convertView = mInflater.inflate(R.layout.tvback_item, parent, false);

        holder = new ViewHolder();
        holder.iv = (ImageView) convertView.findViewById(R.id.tvback_item_image);
        holder.tv = (TextView) convertView.findViewById(R.id.tvback_item_name);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      Object obj = mListItem.get(position).get(KeyEnum.poster.toString());
      if (obj != null) {
        String poster = obj.toString();
        if (!ValidateUtil.isBlank(poster) && holder.iv != null) {
          downloader.download(poster, holder.iv);
        }
      } else {
        Log.w(TAG, "no poster idex=" + position);
      }

      obj = mListItem.get(position).get(KeyEnum.name.toString());
      if (obj != null) {
        holder.tv.setText(obj.toString());
      } else {
        holder.tv.setText("");
        Log.w(TAG, "no name idex=" + position);
      }

      return convertView;
    }
  }