Android Open Source - Twitter-Android User Tweets






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.Fragments;
//www  . j  av a2  s.  c  o m
import android.content.Intent;
import android.os.AsyncTask;
import android.view.View;
import android.widget.ListView;
import info.mahmoudhossam.twitter.R;
import info.mahmoudhossam.twitter.Activities.Tweet;
import info.mahmoudhossam.twitter.TweetAdapter;
import twitter4j.Paging;
import twitter4j.Status;
import twitter4j.TwitterException;

import java.util.List;

public class UserTweets extends TweetFragment {

    private List<Status> timeline;

    @Override
  public void refresh() {
    new RetrieveTweets().execute(paging);
  }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        Status status = timeline.get(position);
        Intent intent = new Intent(getActivity(), Tweet.class);
        intent.putExtra("text", status.getText());
        intent.putExtra("username", status.getUser().getScreenName());
        intent.putExtra("owner", status.getUser().getName());
        intent.putExtra("time", status.getCreatedAt().toString());
        startActivity(intent);
    }

  private class RetrieveTweets extends AsyncTask<Paging, Integer, List<twitter4j.Status>> {

    @Override
    protected List<twitter4j.Status> doInBackground(Paging... arg0) {
      try {
        timeline = twitter.getUserTimeline(arg0[0]);
                return timeline;
      } catch (TwitterException e) {
        e.printStackTrace();
        return null;
      }
    }
    
    @Override
    protected void onPostExecute(List<twitter4j.Status> result) {
      if (result != null) {
        setListAdapter(new TweetAdapter(getActivity()
            .getApplicationContext(), R.layout.tweet, result));
      }
    }
    
  }
}




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