I must have tried about 100 different variations to get this code to work properly and I think I'm going insane.
I've tried many variations with and without the recycle method but I can't prevent the leak. Anyone see where I've gone wrong?
B4X:
Sub btnAxisInterface_Click
Dim imgDocImg As ImageView
imgDocImg.Initialize("imgDocImg")
Activity.AddView(imgDocImg, 0, 0, Activity.Width, Activity.Height)
bmpDocImg.Initialize(File.DirAssets, "Axis_Interface.png")
imgDocImg.Bitmap = bmpDocImg
End Sub
Sub imgDocImg_Click
Dim test As ImageView
test = Activity.GetView(Activity.NumberOfViews-1)
test.RemoveView
test = Null
DoEvents
Dim recycle As Reflector
recycle.Target = bmpDocImg
recycle.RunMethod("recycle")
bmpDocImg = Null
End Sub
I've tried many variations with and without the recycle method but I can't prevent the leak. Anyone see where I've gone wrong?