Android Question Adding Headers to the Listview Save Image

Don Roberts

Member
Licensed User
Hi,
I'm using the following to create an image of my table.

B4X:
Dim Obj1, Obj2 As Reflector
Dim bmp As Bitmap
Dim c As Canvas
Obj1.target = Obj1.GetActivityBA
Obj1.target = scvList.Panel ' on Panel1
bmp.InitializeMutable(Activity.Width,scvList.Panel.Height)
c.Initialize2(bmp)
DoEvents
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)
DoEvents
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "Calculations.jpg", False)
bmp.WriteToStream(out, 100, "JPEG")
out.Close


It works great, but now I am wondering how can I add the headers to the image.
The header is generated at the same time as the table as:
Panel1.AddView(Header, scvList.Left, scvList.Top - RowHeight, scvList.Width, RowHeight)


any help would be appreciated.
 

Don Roberts

Member
Licensed User
Spoke to soon... The first test I had results that fit the screen.
I just ran a test with 2x screen height and all I get is a screenshot.

I get the entire results table
when using:
Obj1.target = scvList.Panel
 
Upvote 0

Don Roberts

Member
Licensed User
I figured it out...
I changed the height of the panel to match the scvlist.
after execution I return them back to the originals.

B4X:
Dim SetHeight As Int, OSHeight As Int,Panheight As Int
' I had another panel on the panel to hide and reclaim space the svclist didn't have

SetHeight=scvList.Panel.Height + 150 ' The height to make the panel
Panheight=Panel1.Height 'Original Height of the panel
OSHeight=scvList.Height 'Original Height of the scvlist

Panel1.Height=SetHeight
scvList.Height=SetHeight

Obj1.target = Panel1
bmp.InitializeMutable(Activity.Width,SetHeight)
c.Initialize2(bmp)
DoEvents
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)
DoEvents
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "Calculations.jpg", False)
bmp.WriteToStream(out, 100, "JPEG")
out.Close

scvList.Height=OSHeight
Panel1.Height=Panheight
 
Upvote 0
Top