I am using glide in order to set images in my GridView, and I am using a library named IOcipher which provides a virtual encrypted disk, so I use info.guardianproject.iocipher.File instead of java.io.file . But glide can't load images, and it has a error saying :
E/Glide: class com.bumptech.glide.load.engine.GlideException: Failed
to load resource
is there any way I could load images? I tried many different ways :(
file.getPath() returns /data/user/0/com.example.zeinab.amndoorbin/app_vfs/myfiles.db/1502685968291.jpg
Glide.with(mContext)
.load(file.getPath()) // Uri of the picture
.into(imageView);
Related
In my application, I was trying to get the thumbnail of a book from google play books API and display it in an image view but somehow what I did is not working.
Glide.with(holder.thumb.getContext())
.load(curThumb)
.into(holder.thumb);
when I used the above method with a local image it worked also thumbnail URL is correct
I tried using Glide v4.0.0-RC1 use RequestOptions to add the placeholder, error image and other options make sure URL(image_url) starts with https, not with HTTP
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.mipmap.ic_launcher_round)
.error(R.drawable.your_error_image);
RequestOptions to add placeholder, error image and to customize image
Glide.with(this).load(image_url).apply(options).into(imageView);
I have an image in my #drawable/myimage.jpg of which I would like to load on my ImageView through Glide. Glide however, only accepts Uri's to load the actual image to the ImageView.
Here's the code:
uriImage = Uri.parse("#drawable/myimage.jpg");
//LOADS IMAGES USING GLIDE
Glide.with(AboutActivity.this).load(uriImage).into(imgView);
It somewhat doesn't work. Is there any work-arounds this?
Sorry for being naive, I just started using Android Studio again :)
try this code:
String imageUrl = getURLForResource(R.drawable.personIcon);
// Load image
Glide.with(patientProfileImageView.getContext())
.load(imageUrl)
.into(patientProfileImageView);
it helps you
Simply do this!
Glide.with(AboutActivity.this).load(R.drawable.resouce_name).into(imgView);
Here in my web-application under Images folder pdficon.png image is available I want to add this image using Image.getInstance() method but whaen I tring like this..
image = Image.getInstance("images/pdficon.png");
Here it showing Exception is
IOException :: C:\Users\Developpc\Downloads\wildfly-9.0.2.Final\bin\images\pdficon.png (The system cannot find the path specified)
So,what I need to do....
Signup for some free image hosting account and upload your image. After uploading your image you can get the URL of the image and put that URL for image.getInstanceMethod.
Image img = Image.getInstance(IMG_URL);
If you are using that image multiple times then create an string constant and use that.
I am using picasso plugin to load image.
Picasso.with(context).load(BackendConfig.media_url+folder+holder.media_name).resize(150, 150).into(holder.imageView);
It's working fine. But, I want to save that image in SD card by loading just once from URL.
How can I do that?
Picasso using LRU disk cache, no need to worry about loading it from URL once. If you need to load and save actual image as file, load it as bitmap resource instead, and use Bitmap.compress and FileOutputStream to save into file (PNG/JPEG/WEBP).
you can use this lightweight android library VINCI (wrot this for my self) its do every thing you want
caching - using LruCache
managing files/bitmaps (Saving files in internalStorage)
read this WIKI part for more visit my github repo .
Storage store = Vinci.base(context).process().load(uri).file();
Log.e("Created", Boolean.toString(store.isCreated()));
Log.e("FileObject", store.FileObject().toString());
Log.e("FullPath", store.getfullPath().getPath());
Log.e("LocalPath", store.LocalPath());
Log.e("Get Bitmap File", String.valueOf(store.getBitmap()));
Usually we loading picture is on FragmentPagerAdapter.getItem method.
such as:
Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error).into(imageView);
Images then don't show in ViewPager probably never download. But, I want to pre-download images. I've used Picasso.with().load(url).downloadOnly, but this causes multiple unnecessary same url downloading.
I want to pre-download images. If have same url image downloading, it merge downloading interface.
I'm using Glide.It's effective and power.Preload image only use preload() method.