-3

I have an image link from server, I want to show it in my android app, I tried this code but not worked for

imageview.setImageURI(Uri.parse("pathofimage"));

Image link is like http:/54.70.37.32/uploads/Provider_profile_pic.jpg

byteC0de
  • 5,153
  • 5
  • 33
  • 66

3 Answers3

3

You can use the Picasso API which has many builtin functions for example:

  • Cache Images
  • Fast loading
  • Masking images

    Now How to use Picasso Library for loading the ImageViews, here it is step by step.

    1. Add Picasso API in your app.gradle file

      compile 'com.squareup.picasso:picasso:2.5.2'

    2. Then Sync your gradle
    3. Now you can load image with following simple line

      Picasso.with(context).load("https://i.stack.imgur.com/jEIKP.jpg").into(imageView);

for further Info go to : Picasso

Faraz Ahmed
  • 1,245
  • 1
  • 14
  • 24
2

Use Picasso Library like this.
Gradle dependency:

compile 'com.squareup.picasso:picasso:2.5.2'

then in your code use this to set image

Picasso.with(YOUR_ACTIVITY_INSTANCE).
load(IMAGE_URL).into(IMAGE_VIEW);

you can also use Glide.

Rajesh Gosemath
  • 1,812
  • 1
  • 17
  • 31
0

Use Android-Universal-Image-Loader

   ImageLoader imageLoader = ImageLoader.getInstance(); // Get singleton instance
// Load image, decode it to Bitmap and display Bitmap in ImageView (or any other view 
//  which implements ImageAware interface)
imageLoader.displayImage(imageUri, imageView);
// Load image, decode it to Bitmap and return Bitmap to callback
imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    // Do whatever you want with Bitmap
}
});
sasikumar
  • 12,540
  • 3
  • 28
  • 48