Android Question File.Copy2() coruptting Bitmaps?

Bill Kantz

Member
Licensed User
Longtime User
I am using file.Copy2() to save some Bitmaps to external storage. If I display them using Job.GetBitmap they display correctly. When written to disk they are either OK, Corrupted or have 0 size.

The code is below.

I added a corrupt Bitmap below.

Thanks, Bill

B4X:
Sub JobDone(Job As HttpJob)
    Dim x As Int
    If Job.Success = False Then
        'log("Error downloading main page.")
        Return
    End If

    Select Job.JobName
        Case "Main page"
            ParseWxXML(Job)
            ParseWxData
        Case "ImageJob"
            File.Copy2(Job.GetInputStream,File.OpenOutput(File.DirRootExternal, "CC.png",False))
            rv.SetImage("CurrentWxView",  Job.GetBitmap)
            rv.UpdateWidget
        Case Else
            x = Job.JobName
            File.Copy2(Job.GetInputStream,File.OpenOutput (File.DirRootExternal, x & ".png",False))
    End Select
    Job.Release
End Sub
 

Attachments

  • CC.png
    8 KB · Views: 214
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…