Posts

Showing posts from September, 2009

Twitter API with Java

Hi, Since Twitter is one of the most widely used ways to share your status with others, I will use this post to display how to use Java to access the Twitter API. I used a Java library named "jtwitter" which can be freely downloaded from "http://www.winterwell.com/software/jtwitter/jtwitter.jar" Once you download the jar file, add it to your project. Then, it becomes very simple to use the API. First build a new Twitter object Twitter twitter = new Twitter("<username>","<password>"); Then set your status to whatever you want twitter.setStatus("Twittering"); To get a list of your friends, simply use the following LOC List followers = twitter.getFriends(); If you need to get the user's image, you can do it in the following manner. 1. Get the URL of the image using Twitter API 2. Use Java Classes to download the image and display it NOTE: The user variable is of type ' Twitter.User ' URL imgURL = user.getProfileIma