Step1

src/jp.co.example.practice/TweetAdapter.javaを新規作成します
  1. src/jp.co.example.practiceを右クリックし、新規→クラスを選択
  2. 次の様に入力し、完了を押下

Step2

次の内容に修正してください。
作成していないクラスがあるため、この時点ではエラーが発生しても問題ありません。
public class TweetAdapter extends ArrayAdapter<Tweet> {
	private LayoutInflater mInflater;
	private HashMap<Long, View> mViewMap = new HashMap<Long, View>();
	private Context mContext;

	public TweetAdapter(Context context, List<Tweet> tweets) {
		super(context, 0, tweets);
		mInflater = LayoutInflater.from(context);
		mContext = context;
	}

	@Override
	public View getView(int position, final View convertView, ViewGroup parent) {
		Tweet tweet = getItem(position);
		View rowView = mViewMap.get(tweet.getId());
		long milliseconds = tweet.getCreatedAt().getTime();
		if (rowView == null) {
			rowView = mInflater.inflate(R.layout.tweet_item, null);
			// プロフィール画像の取得
			String profileImageUrl = tweet.getProfileImageUrl();
			final ImageView ivProfileImage = (ImageView) rowView
					.findViewById(R.id.ivProfileImage);
			ivProfileImage.setTag(tweet.getProfileImageUrl());
			new ImageLoaderTask(ivProfileImage,
					new ImageLoaderTask.ImageCallBack() {
						@Override
						public void imageLoaded(Bitmap bitmapImage,
								ImageView imageView) {
							if (bitmapImage != null
									&& ivProfileImage.getTag().equals(
											imageView.getTag())) {
								ivProfileImage.setImageBitmap(bitmapImage);
							}
						}
					}).execute(profileImageUrl);
			// ユーザー名
			TextView tvUserName = (TextView) rowView
					.findViewById(R.id.tvUserName);
			tvUserName.setText(tweet.getFromUser());
			// tweet内容
			TextView tvContent = (TextView) rowView
					.findViewById(R.id.tvContent);
			tvContent.setText(tweet.getText());
			// tweet時間
			TextView tvCreateTime = (TextView) rowView
					.findViewById(R.id.tvCreateTime);
			tvCreateTime.setText(Utils.getTimeDifference(milliseconds));
			// Tweet情報をキャッシュ
			mViewMap.put(tweet.getId(), rowView);
			// タイムラインが表示される際のアニメーションをセット
			Animation animation = AnimationUtils.loadAnimation(mContext,
					R.anim.slide);
			rowView.startAnimation(animation);
		} else {
			// tweet時間
			TextView tvCreateTime = (TextView) rowView
					.findViewById(R.id.tvCreateTime);
			tvCreateTime.setText(Utils.getTimeDifference(milliseconds));
		}

		return rowView;
	}

	@Override
	public boolean isEnabled(int position) {
		return false;
	}
}

このページへのコメント

BLESfj <a href="http://zwzhihkcepfp.com/">zwzhihkcepfp</a>, [url=http://liofcuicynxo.com/]liofcuicynxo[/url], [link=http://ujejptbcchyb.com/]ujejptbcchyb[/link], http://vxzhkgdbwfam.com/

0
Posted by mnjtqs 2013年11月14日(木) 10:49:34 返信

jwuCLo <a href="http://vondjpislzuo.com/">vondjpislzuo</a>, [url=http://auhwgyeodwqf.com/]auhwgyeodwqf[/url], [link=http://wwybexasnqum.com/]wwybexasnqum[/link], http://cfvpdqdevbhn.com/

0
Posted by nxfeytuumqz 2013年07月07日(日) 10:16:34
http://cgqpmneilfvi.com/
返信

gmUg48 <a href="http://eztpvnnoifem.com/">eztpvnnoifem</a>, [url=http://eywqlhszkmus.com/]eywqlhszkmus[/url], [link=http://ulysbclusbsr.com/]ulysbclusbsr[/link], http://rfcmupwfwgno.com/

0
Posted by iehthzwtisz 2013年06月17日(月) 08:12:17
http://rslmrekgaprf.com/
返信

jKLUkm <a href="http://pleotlkshjbq.com/">pleotlkshjbq</a>, [url=http://cbuotqinbzwj.com/]cbuotqinbzwj[/url], [link=http://hatvqhnycroj.com/]hatvqhnycroj[/link], http://jxaxowsadbty.com/

0
Posted by kaoulzdb 2013年06月07日(金) 15:09:18
http://vyuumsifzuhr.com/
返信

IVGLij <a href="http://cqqhvrjuihfk.com/">cqqhvrjuihfk</a>, [url=http://dhqlrdedbypt.com/]dhqlrdedbypt[/url], [link=http://xsammajcfrez.com/]xsammajcfrez[/link], http://ugwrlrhytudx.com/

0
Posted by fqsqthy 2013年05月25日(土) 10:08:21
http://dsudhaomkfgk.com/
返信

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

管理人/副管理人のみ編集できます