@Override protected void onListItemClick(ListView l, View v, int position, long id) { NewEntity entity = (NewEntity) mAdapter.getItem(position - 1); Intent intent = new Intent(getActivity(), BrowseActivity.class); intent.putExtra(BrowseActivity.EXTRA_URL, entity.getUrl()); intent.putExtra(BrowseActivity.EXTRA_TITLE, entity.getTitle()); startActivity(intent); }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(getActivity()).inflate(R.layout.news_list_item, null); holder.mText1 = (TextView) convertView.findViewById(android.R.id.text1); holder.mText2 = (TextView) convertView.findViewById(android.R.id.text2); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } NewEntity entity = mNews.get(position); holder.mText1.setText(entity.getTitle()); holder.mText2.setText(Html.fromHtml(entity.getSubText())); return convertView; }