Android Question How to save image in File.DirRootExternal and retrieve it

Makumbi

Well-Known Member
Licensed User
i have a round image
at
B4X:
        'ImageView1.SetBackgroundImage(BytesToImage(ktv))
                            ImageView1.SetBitmap(CreateRoundBitmap(Base64StringToImage(ktb), ImageView1.Width))
                   
                        '    SavePhoto(Base64StringToImage(ktb))

i wante

B4X:
Sub SavePhoto (Pt As Bitmap,NewFile As String)
    Dim Out As OutputStream
    Out = File.OpenOutput(File.DirRootExternal, NewFile, False)
    Pt.WriteToStream(Out, 100, "PNG")
    Out.Close
End Sub
 

Attachments

  • setungo.png
    setungo.png
    84.4 KB · Views: 247

DonManfred

Expert
Licensed User
Longtime User
1. Create the Bitmap
B4X:
dim bmp as bitmap = CreateRoundBitmap(Base64StringToImage(ktb), ImageView1.Width)
2. Save the bitmap
B4X:
SavePhoto(bmp, filename)
3. Add the bitmap to the imageview
B4X:
ImageView1.SetBitmap(bmp)
 
Last edited:
Upvote 0
Top