-3

I want to load image stored on a server to imageView

I know how to load images to imageView using

BitmapFactory.decodeStream(inputStream);

But I think that this method is caused security issues because Image URL is open (if know Images URL, they are able to download image in Web , show too.)

And The method should be connected as many as the number of images.

So, i want to know different way to get images at once from server

Do you know any way?? For example using stream or part?? help me~!

tokhi
  • 135
  • 1
  • 8

2 Answers2

1

Used the Android Universal Image-Loader This is best

Declare

    private ImageLoader imageLoader1;

On Create

 imageLoader1 = ImageLoader.getInstance();

 imageLoader1.init(ImageLoaderConfiguration.createDefault(getActivity()));

no_image here a drawable image without any image load in Cache

   DisplayImageOptions
            options = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .showImageOnLoading(R.drawable.no_image) // resource or drawable
            .showImageForEmptyUri(R.drawable.no_image) // resource or drawable
            .showImageOnFail(R.drawable.no_image)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    imageLoader1.displayImage(yourpath.replace(" ", "%20"), ivprofile, options);

Use Also It's dependency

with jar You can easily found latest jar or dependencies

  compile files('libs/universal-image-loader-1.9.5.jar')

and

  compile  'com.nostra13.universalimageloader:universal-image-loader:1.9.1'

You Can Use Piccaso Also and Glide also

Arjun saini
  • 4,223
  • 3
  • 23
  • 51
0

You can use Picasso or Glide to load images with just one line of code. Here is the link.

Picasso:

http://square.github.io/picasso/

Glide:

https://github.com/bumptech/glide

AndroidGenius
  • 101
  • 2
  • 11