获取Twitter个人资料照片

时间:2013-08-05 10:34:08

标签: java android twitter twitter4j

我正在尝试使用特殊的标签创建推文界面,我想在推文中添加个人资料照片图片,有没有办法使用twitter4j获取推特个人资料照片?

2 个答案:

答案 0 :(得分:3)

浏览以下代码。

Assume that the Twitter object is mytTwitter
*get the user from the twitter object

User user = mytTwitter.showUser(mytTwitter.getid());

*get the profile image URL

URL url = user.getProfileImageURL();


*create Image icon

ImageIcon img = new ImageIcon(url);

*set the JLabel icon to be the ImageIcon

Jlabel1.setIcon(img);

答案 1 :(得分:2)

是的,你可以。您必须获得状态,然后:

status.getUser().getProfileImageURL(); //returns a string which is profile image url

详细用法:

getProfileImageURL()

twitter4j Javadoc