Android Question Panel/Layout to Image

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I have a layout with a ScrollView2D panel on it. The panel has a bitmap from a document. The panel is bigger than the actual view (screen dimensions). I also have labels placed on the layout to fill in some text of the document. I hope this will give you a description of the workout.

Is there a way to save this panel (including the panels) or layout to bitmap?

I tried the LayoutToImage library, but only the part of the actual view is set to the bitmap.

I also tried the code of agraham:
B4X:
Sub viewAsBitmap As Bitmap
    Dim Obj1, Obj2 As Reflector
    Dim bmp As Bitmap
    Dim c As Canvas
    Obj1.Target = Obj1.GetActivityBA
    Obj1.Target = Obj1.GetField("vg")
    bmp.InitializeMutable(Activity.Width, Activity.Height)
    Log(Activity.Height)
    Log(Activity.Width)
    c.Initialize2(bmp)
    Dim args(1) As Object
    Dim types(1) As String
    Obj2.Target = c
    Obj2.Target = Obj2.GetField("canvas")
    args(0) = Obj2.Target
    types(0) = "android.graphics.Canvas"
    Obj1.RunMethod4("draw", args, types)
    Return bmp
End Sub

but this gives me an empty bitmap.

If there is no way to set it to bitmap, is there a way to resize the panel/layout to my screen dimensions?

Thanks for helping.

Best regards,
André
 
Top