Unable to set image source when accessing image from gallery-Android

前端 未结 3 608
-上瘾入骨i
-上瘾入骨i 2021-01-07 06:42

Iam using cordova 3.4. When i capture an image and set it,its working fine but when I try to access on image from gallery I get the url

content://com.androi         


        
3条回答
  •  感动是毒
    2021-01-07 07:14

    see this answer:

        if (imageUri.toString().substring(0,21).equals("content://com.android")) {
              String [] photo_split= imageUri.toString().split("%3A");
              String imageUriBasePath = "content://media/external/images/media/"+photo_split[1];
               imageUri= Uri.parse(imageUriBasePath );
    
            }
    

提交回复
热议问题