5

I have a very weird issue. I am picking an image from a gallery the code is working properly on all the devices like Nokia 6 , One Plus X. When it comes to xiaomi devices the image is not getting set on ImageView .

Can anyone help me out on how to fix this issue ? I have to pick multiple images.
Code to pick image from gallery

Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
        intent.setType("image/*");
        intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
Hans1984
  • 796
  • 11
  • 24
Saurabh sharma
  • 369
  • 2
  • 13
  • "but when it comes to xiaomi devices the image is not getting set on ImageView" -- your question does not show any code for doing this. – CommonsWare Jul 10 '17 at 14:12
  • thanks for the reply ..actually it is not some special code i am using Picasso in which i am just passing image path to load images , i have also tried with Glide as well but none of these worked – Saurabh sharma Jul 10 '17 at 14:14
  • 2
    Please provide a [mcve] showing your code for using Picasso or Glide. There is no "image path". Pass the `Uri` to the library (and, in the case of multiple images, give the image `Uri` the proper way). – CommonsWare Jul 10 '17 at 14:17
  • @Saurabhsharma Any exception OR error log are u getting from there?? Than plz paste it along with question – Ravindra Kushwaha Jul 10 '17 at 14:21
  • @RavindraKushwaha no exception is coming – Saurabh sharma Jul 11 '17 at 06:35
  • @CommonsWare The issue is on some Xiomi devices the result code is coming as "0" which is for RESULT_CANCELED. Also the data us coming as null. Facing this problem in this sample project as well: https://github.com/rifqimfahmi/BetterImageUpload – Saty Aug 24 '21 at 06:25

1 Answers1

-1

Remove multiple images selection if you are selecting then you need to resolve it by Cursor in a new String array.

and also add these two lines in your code:

 android:hardwareAccelerated="false"

   android:largeHeap="true"
Pradeep Kumar
  • 2,349
  • 1
  • 10
  • 18