Download and display svg image in Android - android

I am trying to download and display an svg image in my ImageView. I am using Picasso to display my other images from the web. However, now I have to show the svg images and I cannot get to decode the image.
This is how I do he rest of the images :-
Picasso.with(context)
.load(mProject.getAvatar())
.placeholder(R.drawable.ic_description_blue_grey_600_36dp)
.error(R.drawable.ic_description_blue_grey_600_36dp)
.centerCrop()
.into(holder.thumbnail);
How can I display SVG images from the web? Any help is appreciated.

use this library
AndroidSvgLoader

Related

How can I use the glide to load partial image from Internet

My Android application need load amounts image from Internet with api,those pictures so big and massive that need more Lots of bandwidth,So I want load partial(compress) image to save bandwidth.
At first,I tried to use the 'thumbnail' of Glide,it was seem work,the image is compressed but it load full image final.
Then,I tried to use the 'override' of Glide,but it only resized the picture in ImageView,The full image is downloaded too.
//The Thumbnail() can load the partial image at first,but download full picture final
Glide.with(mContext).load(item.imgUrl).thumbnail( 0.5f )
.apply(bitmapTransform(new RoundedCornersTransformation(50, 0)))
.into(myViewHolder.commodityImage);
//The override() can resize the picture inside ImageView,but it download the full picture too!
Glide.with(mContext).load(item.imgUrl)
.apply(bitmapTransform(new RoundedCornersTransformation(50, 0)).override(400,400))
.into(myViewHolder.commodityImage);
So,is there a way to download the image partially like the Glide thumbnial but do not download full picture.
Try to used this..
Glide.with(imageView)
.load(path)
.apply(RequestOptions().placeholder(R.drawable.place_holder).override(500, Target.SIZE_ORIGINAL))
.into(imageView)

Loading image in android imageview

How to load images in same image view from web or local android gallery?
I have an image view which has three options for loading images templates from web service,from gallery, from camera.I am using Glide library to load images from web service, Now, if i load image from web by glide and remove that image by remove button which i have for removing a picture after i pick image from gallery it doesn't load the image from gallery instead load the same image from glide which i removed before.
write the code like this for loading image .
Glide.with(mContext).load(imgUrl)
.thumbnail(0.5f)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(imageView);
Glide Library Intoduction Go through with this link, hope it will be work
You can use Picasso library. Image loading using Picasso is very easy, you can do it like this way
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
and in their website you can get every details.
and another Library is Glide. You can use Glide too for loading image..
You can also use Glide:
Glide.with(context).load(image).asBitmap().placeholder(R.drawable.placeholder).error(R.drawable.error).into(imageview);

loading image into android imageView with ion returns a blurry result

I'm trying to load an image from filesystem into an imageView with the ion library.
When I'm using the following code:
Ion.with(imageView)
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.load(uri);
it (sometimes) results in a kind of blurry image.
When not using ion like the following the pictures appear sharply:
imageView.setImageBitmap(BitmapFactory.decodeFile(uri.toString()));
Is there a standard compression coming with ion that I can disable?
Strangely not every picture is blurry when using ion, e.g. I have two identical images, only with another name. When I load them into the imageView with ion one is blurry, one is not.
Any help or tips are appreciated!
Ion tries to load the image to fit the bounds of the ImageView. So make sure your ImageView is sized properly in your layout. Alternatively, if you use adjustViewBounds=true to indicate the ImageView is adjusted by the image contents, it won't do that. Or alternatively smartsize(false).
Try this,
Ion.with(context)
.load(url)
.withBitmap()
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.intoImageView(imageView);

Reducing Image Size at Runtime for Android app

I am parsing a json schema which contains textual info and image urls for my android app. I want to read all the images from the schema and then show them in the gallery view of my android app.
But the problem is, the image urls contain HD pics and it takes a lot of time to load. Is there a way I can reduce the size of those images at run time and then display or can you suggest any improvement tip so that the images could load quickly from the schema?
Thanks
Try using Picasso library, it can resize your images whatever you like and bind it to ImageView. See also my answer here.
But if your images on your server are too big, it all depends on your internet connection, how fast they get to your device.
You can resize your image downloaded from url using picasso library. Also it will allow lazy loading of images and you can also set placeholder and error images in your imageview.
You can read complete documentation here: http://square.github.io/picasso/
Picasso.with(context)
.load(url)
.resize(50, 50)// resizing images
.centerCrop()
.into(imageView)

Load a downscaled image with Android-Universal-Image-Loader

I am using Android-Universal-Image-Loader to load an image into an imageView. Is it possible to show a downscaled version of the image i am loading while the original image has not yet loaded?
As suggested here, the way to achieve your goal would be prepare and download two images, one with less size to show as preview while the big one is downloading

Categories

Resources