Convert Uri to String and String to Uri

前端 未结 5 1614
灰色年华
灰色年华 2020-12-08 18:37

I\'m developing some Application which allows select image from SD Card, save it into database and set this value for ImageView. I need to know way for converting uri to str

5条回答
  •  Happy的楠姐
    2020-12-08 18:46

    I need to know way for converting uri to string and string to uri.

    Use toString() to convert a Uri to a String. Use Uri.parse() to convert a String to a Uri.

    this code doesn't work

    That is not a valid string representation of a Uri. A Uri has a scheme, and "/external/images/media/470939" does not have a scheme.

提交回复
热议问题