error in `Image` download In `Universal Image Loader` - android

I am using Universal Image-loader,but sometime i am getting error while loading image.
"Image can't be decoded http:/***************/assets/images/NorthernMockingbird1.jpg_600x1024".
i am not getting any solution please suggest me what to do.
thanks in advance

Error:
Image can't be decoded
http:/***************/assets/images/NorthernMockingbird1.jpg_600x1024
From Error i can see that image file extension is .jpg_600x1024 which is not standard image extension so Universal Image Loader is not able to decode Image.
Try to get Image file name with proper extension.
I hope it helps you.

Related

Getting error while setting image from parse to imageview

I am using holder to set images from Parse to my image view, below is following code
holder.rank.setText(worldpopulationlist.get(position).getRank());
holder.country.setText(worldpopulationlist.get(position).getCountry());
holder.population.setText(worldpopulationlist.get(position).getPopulation());
holder.flag.setImageResource(Integer.parseInt(worldpopulationlist.get(position).getFlag()));
And below is the error given by android studio
java.lang.NumberFormatException: Invalid int: "http://listview123.herokuapp.com/parse/files/hlkhlkhyuiyemnbbmbackguyweuiyqw/10ad83c5546b993c18be84402e0f2bff_android_1.png"
You can't just say "here is the url of the image, do something"
You have to download the image and set is as the wanted resource.
For a guide look here
Or if you want to use an external library you could, like Azmat said, use Picasso
Picasso.with(context).load(imageURL).into(myImageView);
You can use Picasso to load images from link
Picasso.with(context).load(worldpopulationlist.get(position).getFlag()).into(holder.flag);
p.s: this code works if your worldpopulationlist.get(position).getFlag() returns link for file.

How to download a file and open it in imageView?

The URL do not ends in .png or .jpg or any image format
URL is like this:https://www.abcdef.com/funlearn/downloadFile?id=27
and it is an image.If I paste the URL in any browser it starts downloading the file with .jpg extension as food.jpg.
Picasso.with(getApplicationContext())
.load("http://i.imgur.com/DvpvklR.png")//working
// .load("https://www.abcdef.com/funlearn/downloadFile?id=27")//Not working
.into(image);
getting this error :D/skia: --- SkImageDecoder::Factory returned null
Reason is whatever you put inside a" load" should be a file. End thing should be a file. Picasso try to load that file for you. You can use it to load a file in your device sdcard etc. Specifically file should be a image or video. Hope it helps

Android loading local image with space in path and with universal image loader

I am developing android application in which I want to display local image with the help of universal image loader. But when I try to display image which has space in it's local image path then it not able to display image. I tried it in following manner:
Uri.fromFile(new File(newImagePath)).toString();
I am getting following error:
java.io.FileNotFoundException: /storage/emulated/0/WhatsApp/Media/WhatsApp%20Images/IMG-20150421-WA0002.jpg: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:456)
If tried to load image which has no space in its local path then it works fine but image with space in its path cause issue. Need some help. Thank you.
Actually its problem with universal image loader. https://github.com/nostra13/Android-Universal-Image-Loader/issues/371
So you just have decode your image path to remove space.
As per discussion in above link I got the solution :
final String uri = Uri.fromFile(file).toString();
final String decoded = Uri.decode(uri);
ImageLoader.getInstance().displayImage(decoded, imageView);
Can you try to replace space with "\u0020";
path = path.replace(" ","\u0020");

Android display image from sdcard using AQuery or Picasso

message="file:///storage/sdcard0/My Folder/images/Camera_1415795981117.jpg"// image is available at this location
Picasso.with(context).load( message+"")
.into(holder.iv_message_image);
have also tried
message="storage/sdcard0/Fresh IM/images/Camera_1415795981117.jpg";
also tried
message="file://storage/sdcard0/My Folder/images/Camera_1415795981117.jpg";
and also tried with AQuery
aQuery.id(holder.iv_message_image).image(message)
.progress(R.id.pb_loading);
both picasso and AQuery load images from url properly but not from local Please help!
Using Picasso-2.2.0 jar
Thanks in Advance,
Pragna
For your solution this will help. To display image from SDcard you need to convert it to URI first.
Uri uri = Uri.fromFile(new File(message));
Picasso.with(context).load(uri)
.into(holder.iv_message_image);
Must check your image path message is not wrong.
The following code would be very helpful and make sure that you are loading file when you want to load an image from SD card.
Picasso.with(context).load(new File(path)).into(imageView);

displaying image in the imageview directly from the internet

I want to load an image which is located at the url "http://www.Karnatakatourism.org/mm/slide/chickmaglur_home.jpg" onto the imageview in Android.
Can anyone help me with the code to do the same?
You can use android query lib. http://code.google.com/p/android-query/wiki/ImageLoading
You just need to write
aq.id(R.id.imageview_profilee).image("your path");
You can use this one...
There many libs to do this, You can use Picasso.
Here an example of usage:
Picasso.with(context).load("http://www.karnatakatourism.org/mm/slide/chickmaglur_home.jpg").into(imageView);
Or you can use Universal Image Loader class
in which you can use by this one.
imageLoader.displayImage("http://www.karnatakatourism.org/mm/slide/chickmaglur_home.jpg", imageView, options);

Categories

Resources