Back to project page SimpleTwitterClient.
The source code is released under:
MIT License
If you think the Android project SimpleTwitterClient 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.nickrasband.simpletwitterclient; /*from w ww. j a v a 2 s.c o m*/ import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import com.nickrasband.simpletwitterclient.models.Tweet; import com.nickrasband.simpletwitterclient.models.User; import com.nostra13.universalimageloader.core.ImageLoader; public class TweetsAdapter extends ArrayAdapter<Tweet> { public TweetsAdapter(Context context, ArrayList<Tweet> tweets) { super(context, 0, tweets); } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; // If convertView is null, we need to inflate a new view instead of reusing one. if (view == null) { LayoutInflater inflater = LayoutInflater.from(getContext()); view = inflater.inflate(R.layout.tweet_item, null); } // Retrieve the tweet. Tweet tweet = getItem(position); // Finally, update the view with the tweet information and return the view. ImageView ivProfilePic = (ImageView)view.findViewById(R.id.ivProfilePic); TextView tvMessage = (TextView)view.findViewById(R.id.tvMessage); TextView tvName = (TextView)view.findViewById(R.id.tvName); TextView tvScreenName = (TextView)view.findViewById(R.id.tvScreenName); TextView tvTimestamp = (TextView)view.findViewById(R.id.tvTimestamp); User user = tweet.getUser(); ImageLoader.getInstance().displayImage(user.getProfilePicUrl(), ivProfilePic); tvMessage.setText(tweet.getMessage()); tvName.setText(user.getName()); if (user.getScreenName() != "") { tvScreenName.setText("@" + user.getScreenName()); } tvTimestamp.setText(tweet.getTimestamp()); return view; } }