Sharing Bitmap via Android Intent

后端 未结 8 1552
名媛妹妹
名媛妹妹 2020-12-02 17:35

In my android app, I have a bitmap (say b) and a button. Now when I click on the button, I want to share the bitmap. I am making use of the below code inside my onClic

8条回答
  •  独厮守ぢ
    2020-12-02 18:01

    Quoting the documentation:

    A content: URI holding a stream of data associated with the Intent, used with ACTION_SEND to supply the data being sent.

    b, therefore, is not supposed to be a Bitmap, but rather a Uri pointing to a Bitmap, served by a ContentProvider. For example, you could write the Bitmap to a file, then use FileProvider to serve it.

提交回复
热议问题