sulphuric Acid
sulphuric Acid

Reputation: 585

unable to load image in android using picasso library

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

Answers (5)

user3913975
user3913975

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

user6310445
user6310445

Reputation:

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

Upvotes: 2

Sathish Kumar J
Sathish Kumar J

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

user6309365
user6309365

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

Nitesh Pareek
Nitesh Pareek

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

Related Questions