I've been trying to get a ScrollView's Panel content as a bitmap, but Scrollview.panel is reported as "Layout not available". This I think is due to memory management.
I have a function that gets a bitmap from a view:
I have a function that gets a bitmap from a view:
B4X:
Sub GetBitmapFromView(VwSource As View) As Bitmap
Dim StrMethod As String = "Sub GetBitmapFromView(VwSource As View) As Bitmap"
Dim BmpResult As Bitmap = Null
Try
Dim IntWidth As Int
IntWidth = VwSource.Width
Dim IntHeight As Int
IntHeight = VwSource.Height
Dim Bmp As Bitmap
Bmp.InitializeMutable(IntWidth, IntHeight)
Dim Cnv As Canvas
Cnv.Initialize2(Bmp)
Dim Rfl As Reflector
Rfl.Target = Cnv
Dim AryObjectRef(1) As Object
AryObjectRef = Array As Object (Rfl.GetField("canvas"))
Dim AryObjectTypeRef(1) As String
AryObjectTypeRef = Array As String ("android.graphics.Canvas")
Dim RftView As Reflector
RftView.Target = VwSource
RftView.RunMethod4("draw", AryObjectRef, AryObjectTypeRef)
BmpResult = Bmp
Catch
CdException.Show(StrClass, StrMethod, LastException)
End Try
Return BmpResult
End Sub
Last edited: