Android- how can I convert android.net.Uri object to java.net.URI object?

前端 未结 5 1450
一整个雨季
一整个雨季 2020-11-30 02:41

I am trying to get a FileInputStream object on an image that the user selects from the picture gallery. This is the android URI returned by a

5条回答
  •  情话喂你
    2020-11-30 03:24

    I voted for jgilrincon's answer. I can't comment due to low reputation, and here goes some additional info - you can use FileHelper.java from Apache Cordova project, it has functions that you need for file handling from Uri strings, considering mediastore as well (and app assets folder)

    Particularly this method provides InputStream from Uri:

    public static InputStream getInputStreamFromUriString(String uriString, Activity cordova)
    

提交回复
热议问题