2013-08-05 181 views

回答

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); 
+0

我使用的是android,如何从url加载imageview? –

+0

用于从Url加载图片使用URLImageViewHelper库,请转到以下链接https://github.com/koush/UrlImageViewHelper,下载库并为图片编写代码,如下所示UrlImageViewHelper.setUrlDrawable(this,holder.imageView,URL,R.drawable .temp_profile_pic_placeholder); – mdDroid

2

是的,你可以。你必须得到一个状态,然后:

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

有关详细用法:

getProfileImageURL()

twitter4j Javadoc

+0

感谢您的帮助:) –

相关问题