Android Open Source - Twitter-Android Tweet Adapter






From Project

Back to project page Twitter-Android.

License

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.

Java Source Code

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;
  }

}




Java Source Code List

info.mahmoudhossam.twitter.MyEndlessAdapter.java
info.mahmoudhossam.twitter.TweetAdapter.java
info.mahmoudhossam.twitter.TwitterBackend.java
info.mahmoudhossam.twitter.Activities.Browser.java
info.mahmoudhossam.twitter.Activities.Login.java
info.mahmoudhossam.twitter.Activities.MainActivity.java
info.mahmoudhossam.twitter.Activities.PostStatus.java
info.mahmoudhossam.twitter.Activities.Tweet.java
info.mahmoudhossam.twitter.Fragments.HomeTweets.java
info.mahmoudhossam.twitter.Fragments.Mentions.java
info.mahmoudhossam.twitter.Fragments.TweetFragment.java
info.mahmoudhossam.twitter.Fragments.UserTweets.java