Android Question WriteToStream problem

rossati

Active Member
Licensed User
Longtime User
Hi
Wy this code doens't works?
B4X:
    Dim fileTypeMap As Map = CreateMap("png":"PNG","jpg":"JPEG")
    Dim fileType As String = "png"
    If jpg.Checked Then fileType = "jpg"
    Dim Out As OutputStream = File.OpenOutput(File.DirDefaultExternal,fileName.Text & "." & fileType, False)    ' for possibly save image
    cnvs.Bitmap.WriteToStream(Out, 100, fileTypeMap.Get(fileType)) ' cnvs.Bitmap.WriteToStream(Out, 100, "JPEG")
My be I must cast a string to As android.graphics.Bitmap.CompressFormat?
Regards
 

rossati

Active Member
Licensed User
Longtime User
There is the close of stream; error is on WriteToStream, indeed this works:
cnvs.Bitmap.WriteToStream(Out, 100, "JPEG")
Below the error
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…