4

I am using Glide to Load an Image from my phone memory. My Image View is defined as:

   ImageView ivx=(ImageView)view.findViewById(R.id.ivx);

And the code for loading the image from phone into the image view using Glide is:

  Glide.with(getActivity()).load(new File("/storage/emulated/0/somefolder/MEDIA/PROFILEIMAGES/PROFILE_image1.jpg").toString())
            .listener(new RequestListener<String, GlideDrawable>() {
                @Override
                public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
                    Log.e("xmx1","Error "+e.toString());
                    return false;
                }

                @Override
                public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                    Log.e("xmx1","no Error ");
                    return false;
                }
            })
            .into(ivx);

The problem I have been facing is that this code is throwing an Exception for:

  Error java.lang.RuntimeException: setDataSource failed: status = 0x80000000

I have checked the file, the file is there in the folder! But Glide is not loading the image file into image view!

Can somebody please tell me What I have been doing so wrong!

Thanks in advance

The Angel Cat
  • 59
  • 2
  • 10

1 Answers1

6

Well, code seems fine but 0x80000000 means that the file is incomplete, corrupted or something like that.

So try: other images, or try to put the image path in string first and then open it as new file.