Reputation: 585
hope you are doing good,I am working on an app,In that i want to load an image from url into an imageView,I have used Picasso lib for this,But it gives me uncaught exception,I have checked and debugged for is proper url is coming or not and its perfect,Still i am facing this issue,Can anybody help me to solve this?my code is as below: code
Picasso.with(NewProfileActivity.this)
.load(mUser.userAvatarPath)
.into(iv_profile);
here,"iv_profile" is imageView,mUser.userAvatar Path is image url.
Upvotes: 1
Views: 4649
Reputation:
Please check your image URL, if it is not containing http:// prefix then the images will not be loaded. Make sure the image URL is prefixed with http://
Upvotes: 1
Reputation:
Picasso.with(this).load("http://city/1.jpg").placeholder(getResources().getDrawable(R.drawable.ic_city)).into(imageViewCity);
Upvotes: 2
Reputation: 4335
Try this,
Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.into(imageView);
placeholder helps when your original url is not loaded.
and put
<uses-permission android:name="android.permission.INTERNET" />
to your manifest.xml
This may helps you.
Upvotes: 0
Reputation:
try this
Picasso.with(this).load("http://api.androidhive.info/json/movies/1.jpg").placeholder(getResources().getDrawable(R.drawable.ic_launcher)).into(imageViewCenter);
Upvotes: 6
Reputation: 362
Use this code its work in your case
Picasso.with(mContext).load(Imagename.png).fit().centerCrop().error(R.mipmap.ic_profile).fit().placeholder(R.mipmap.ic_profile).fit().into(imgNDProfile);
Upvotes: -2