Android Question Bitmap out of memory / canvas initialize

wimpie3

Well-Known Member
Licensed User
Longtime User
Just a quick question.

I have a global DIMmed canvas.

I want to re-use that canvas a few times, and each time I do a cvs.Initialize(Panel). This gives me an out of memory after a while.

I thought cvs.Initialize would REuse the same canvas, but instead it's creating a new one every time - even when the canvas is DIMmed globally?
 

eurojam

Well-Known Member
Licensed User
Longtime User
you can recycle the canvas like this:
B4X:
Dim Obj1 As Reflector
Obj1.Target = canvas1
Obj1.Target = Obj1.GetField("bw")
Obj1.Target = Obj1.RunMethod("getObject")
Obj1.RunMethod("recycle")
 
Upvote 0
Top