How To Convert A Bitmap Image To Uri

前端 未结 2 577
悲哀的现实
悲哀的现实 2020-12-18 11:55

I have not found the answer to this question anywhere.

The Bitmap Image is processed in The application, meaning there is no File path to get the Image.

Belo

2条回答
  •  天命终不由人
    2020-12-18 12:42

    Use compress() on Bitmap to write the bitmap to a file. Then, most likely, use FileProvider to serve that file, where getUriForFile() gives you the Uri corresponding to the file.

    IOW, you do not "convert" a bitmap to a Uri. You save the bitmap somewhere that gives you a Uri.

提交回复
热议问题