Back to project page Twitter-Android.
The source code is released under:
Apache License
If you think the Android project Twitter-Android 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 info.mahmoudhossam.twitter; //w w w . j a v a 2 s . c om 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 twitter4j.Status; import java.util.List; public class TweetAdapter extends BaseAdapter { private List<Status> list; private int layout; private Context ctx; public TweetAdapter(Context context, int resource, List<Status> tweets) { list = tweets; layout = resource; ctx = context; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(layout, null); } TextView text = (TextView) convertView.findViewById(R.id.tweet); TextView name = (TextView) convertView.findViewById(R.id.name); Status current = list.get(position); text.setText(current.getText()); name.setText(current.getUser().getName()); return convertView; } @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return list.get(position); } @Override public long getItemId(int position) { return getItem(position).hashCode(); } @Override public boolean isEmpty() { return getCount() == 0; } }