This is the error i am getting when i am trying to upload the image from Mi mobile.But for other phones it working fine
java.lang.RuntimeException: Failure delivering result
ResultInfo{who=null, request=1, result=-1, data=Intent { flg=0x1 clip={image/* text/uri-list U:content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FDCIM%2FCamera%2FIMG_20171107_230239.jpg} (has extras) }} to activity {com.fullstacknet.chatapp/com.fullstacknet.chatapp.ChatActivity}:
java.lang.IllegalArgumentException: Invalid URI: content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FDCIM%2FCamera%2FIMG_20171107_230239.jpg
at android.app.ActivityThread.deliverResults(ActivityThread.java:4108)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4151)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1551)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6195)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764)
Caused by: java.lang.IllegalArgumentException: Invalid URI: content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FDCIM%2FCamera%2FIMG_20171107_230239.jpg
at android.provider.DocumentsContract.getDocumentId(DocumentsContract.java:917)
at com.fullstacknet.chatapp.ChatActivity.getRealPathFromURI(ChatActivity.java:896)
at com.fullstacknet.chatapp.ChatActivity.onActivityResult(ChatActivity.java:962)
at android.app.Activity.dispatchActivityResult(Activity.java:6998)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4104)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4151)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1551)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6195)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764)
11-08 13:38:59.261 28831-28831/com.fullstacknet.chatapp E/MQSEventManagerDelegate: failed to get MQSService.
I'm selecting the image using this Intent:
Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), 1);
It is not hitting the onActivityResult
after selecting the image
Please help me out how to fix this.
Thanks