Back to project page SimpleReader.
The source code is released under:
Apache License
If you think the Android project SimpleReader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.dreamteam.app.adapter; // w w w .j a va2 s . c o m import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.dreamteam.app.entity.RSSFeedCategroy; import com.dreateam.app.ui.R; /** * @description * @author zcloud * @date 2013?11?1? */ public class FeedCategoryAdapter extends BaseAdapter { private Context context; private LayoutInflater inflater; private List<RSSFeedCategroy> categroies; public FeedCategoryAdapter(Context context, List<RSSFeedCategroy> categroies) { this.context = context; this.categroies = categroies; } public void bindData(List<RSSFeedCategroy> categroies) { this.categroies = categroies; } @Override public int getCount() { return categroies.size(); } @Override public Object getItem(int position) { return categroies.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.category_item, null); viewHolder = new ViewHolder(); viewHolder.categoryDescription = (TextView) convertView .findViewById(R.id.category_description); viewHolder.categoryTitle = (TextView) convertView .findViewById(R.id.category_title); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.categoryTitle.setText(categroies.get(position).getTitle()); viewHolder.categoryDescription.setText(categroies.get(position).getDescription()); return convertView; } private static final class ViewHolder { TextView categoryTitle; TextView categoryDescription; } }