IN THIS CHAPTER
Posting on Twitter with Android code
Tweeting with your app on a user's behalf
Using Java exceptions to get out of a jam
A reader from Vancouver (in British Columbia, Canada) writes:
“Hello, Barry. I just thought I would ask that you include the area that seems to get attention from app developers: programs connecting with social sites. I look forward to reading the new book! Best regards, David.”
Well, David, you've inspired me to create a Twitter app. This chapter's example does two things: Post a new tweet and get a twitter user's timeline. The app can perform many more Twitter tasks — for example, search for tweets, look for users, view trends, check friends and followers, gather suggestions, and do lots of other things that Twitter users want done. For simplicity, though, I have the app perform only two tasks: tweet and display a timeline.
I can summarize the essence of this chapter's Twitter code in two short statements. To post a tweet, the app executes
twitter.updateStatus("This is my tweet.");
And, to display a user's timeline, the app executes
List<twitter4j.Status> statuses = twitter.getUserTimeline("allmycode"); ...