-1

I need to show the image from url but my code does not work I try this:

File file = new File(imagePathFromServer);
Uri uri = Uri.fromFile(file);
((ImageView) dialog.findViewById(R.id.image)).setImageURI(uri);

How to show it? The imagePathFromServer is correct (I can open it in browser)

HK.avdalyan
  • 724
  • 1
  • 6
  • 21
  • Hope you have tried to Google it. If not then do it and also search existing threads on Stackoverflow. You will find plenty of examples. – Paresh Mayani Apr 29 '14 at 08:45
  • possible duplicate of [Load image from url](http://stackoverflow.com/questions/5776851/load-image-from-url) – Paresh Mayani Apr 29 '14 at 08:47

2 Answers2

1

Download the picasso library and add to your project vía jar, maven or gradle. Then,

Example in one line of code:

 Picasso.with(context).load("http://example.com/logo.png").into(imageView);
Barışcan Kayaoğlu
  • 1,294
  • 3
  • 14
  • 35
1

try below code:-

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).defaultDisplayImageOptions(options)
            .build();
    ImageLoader.getInstance().init(config);

ImageLoader.getInstance().displayImage(Uri.parse(imgURL).toString(), imgPost);

lib

https://github.com/nostra13/Android-Universal-Image-Loader

duggu
  • 37,851
  • 12
  • 116
  • 113