Dear All,
I´m trying to use contentchooser to copy an image to a temporary location/file. This works fine, except for that the image gets truncated by 4 kilobytes, and cannot be read afterwards, neither when assigned in b4a to a bitmap, nor when using gallery, es file explorer etc. Viewing the image when copied to Windows is not a problem. Here´s my code:
I´m trying to use contentchooser to copy an image to a temporary location/file. This works fine, except for that the image gets truncated by 4 kilobytes, and cannot be read afterwards, neither when assigned in b4a to a bitmap, nor when using gallery, es file explorer etc. Viewing the image when copied to Windows is not a problem. Here´s my code:
B4X:
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
If Success Then
Dim jo As JavaObject
Dim cd As String = jo.InitializeStatic("anywheresoftware.b4a.objects.streams.File").GetField("ContentDir")
Dim in As InputStream = File.OpenInput(cd, FileName)
File.Delete(imageFolder, tempImageFile)
Dim out As OutputStream = File.OpenOutput(imageFolder,tempImageFile,False)
File.Copy2(in, out)
Else
ToastMessageShow("No image selected", True)
End If
End Sub