2016-05-09 141 views
1

希望你做得很好,我正在一个应用程序,因为我想从url加载图像到一个imageView,我已经使用毕加索lib这个,但它给?我未捕获的异常,我已经检查和调试的是正确的网址是来还是不来和它完美的,不过我面对这个问题,任何人可以帮助我解决这个我的代码如下: 代码无法加载图像在Android使用毕加索图书馆

Picasso.with(NewProfileActivity.this) 
         .load(mUser.userAvatarPath) 
         .into(iv_profile); 

这里“iv_profile”是imageView,mUser.userAvatar路径是图片url。

+1

包含错误 –

+0

@TimCastelijns - 它的uncaughtException。 –

+0

这并不意味着很多。包括堆栈跟踪 –

回答

6

试试这个

Picasso.with(this).load("http://api.androidhive.info/json/movies/1.jpg").placeholder(getResources().getDrawable(R.drawable.ic_launcher)).into(imageViewCenter); 
+1

@ monty-perfect ...谢谢兄弟 –

-2

使用此代码的工作,你的情况

Picasso.with(mContext).load(Imagename.png).fit().centerCrop().error(R.mipmap.ic_profile).fit().placeholder(R.mipmap.ic_profile).fit().into(imgNDProfile); 
+0

不工作... !!! –

+0

可能是你的代码在其他地方发现错误,可能是你的图片名称有大写字母或其他问题检查我们的代码人.. –

0

试试这个,

Picasso.with(context) 
.load(url) 
.placeholder(R.drawable.user_placeholder) 
.error(R.drawable.user_placeholder_error) 
.into(imageView); 

占位帮助没有加载你的原始URL时。

,并把

​​

您的manifest.xml

这可能帮助你。

2
Picasso.with(this).load("http://city/1.jpg").placeholder(getResources().getDrawable(R.drawable.ic_city)).into(imageViewCity); 
0

请检查您的图片网址,如果它不包含http://前缀则图片将不会被加载。确保图片网址的前缀为http://