Android display image from sdcard using AQuery or Picasso - android

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);

Related

android Picasso load image from storage

i am using Picasso for load image from web and local storage
for load image from web
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
and for load image from storage i add file:// before path for load image
Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);
but when file path have utf-8 charchter with file name its not load the image like file:///android_asset/۲۰۱٧.png
any idea how to solve it every time i want to use picaso its must string path not Uri or File because its saved in sqlite as string
Try this code:
String url = "file:///android_asset/۲۰۱٧.png";
URLEncoder.encode(url, "UTF-8");
Picasso.with(context).load(url).into(imageView2);
try doing
URIUtil.encodeQuery(url)
see the issue at:
https://github.com/square/picasso/issues/652

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

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.

Load the images from the Gallery into gridview

This LazyLoading library helps me to load the images from the internet. Can i use this library to load the images from the gallery.
imageLoader.DisplayImage(url, image);
What should i send the argurment to display the image from the gallery
Note I'm having the path of the images in the ArrayList
Imp Note : I'm also having the ArrayList of byteArray (one byte array resembles to one image). So then how can i use the library
Edit I encrypted some images from the gallery and stored in SDCard and i need to display the encrypted images in my app(I know the path of the encrypted images) Encryption is done in Byte[] level.
Please suggest me. ThankYou
Can i use this library to load the images from the gallery?
Gallery itself a application which is showing images from your local folder. So if you have a local image you can show it by its path in your App.
You just need to add file in your image path to make path as URI.
Like
String URL = "file:///mnt/sdcard/image.png"; // from SD card

How to load image from SD card using Picasso library

i need to load images from the Sd card into gridview.
For efficiency i'm using Picasso Library
Picasso.with(activity).load(images.get(position).getDataPath())
.resize(96, 96).centerCrop().into(viewHolder.image);
I used the following code in the adapter. unfortunately m unable to see any images
so please can any one help.
Note
And also can anyone suggest any efficient image loading library to load the images from the sd card.
Requirement
I dont to load the image every time when scrolling. If it is already loaded dont load the image on scrolling
To load the file you need to convert it to a uri first
Uri uri = Uri.fromFile(new File(images.get(position).getDataPath()));
Picasso.with(activity).load(uri)
.resize(96, 96).centerCrop().into(viewHolder.image);
Requirement I dont to load the image every time when scrolling. If it
is already loaded dont load the image on scrolling
Picasso is excellent for this
In Picasso version 2.5.2, you need to pass a File as argument to load method, so the image can be loaded as:
Picasso.with(context).load(new File(images.get(position).getDataPath()))
.resize(96, 96).centerCrop().into(viewHolder.image);
I didn't want to create a new File because if the path was already obtained from an existing file, there is no need for a new object (want to see the already existing picture in the device).
According to Picasso docs you have to do something like this:
file:///android_asset/DvpvklR.png
So I used to have:
/storage/sdcard/Pictures/findyoursport/yoursport_1482358052384.jpeg
Prepending: file:// did the trick

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