Java method recycle not found

eps

Expert
Licensed User
Longtime User
Okay, I'm sure I'm doing something wrong...

I'm trying to do this :

B4X:
Dim Obj1 As Reflector
Obj1.Target = bmp ' bmp is the unwanted Bitmap
Obj1.RunMethod("recycle")


Slightly differently to the above but essentially the same - will check if that's the issue..

I get the following error :

Obj1.RunMethod("recycle"")
java.lang.NoSuchMethodException:recycle

I'm fairly certain I've called it correctly, I've tried checking forum for an answer, but can't seem to find anyone else with this issue..

I've got version 2.00 of the Reflection library... although my manifest was set to not be overwritten.. which I know is old hat, but that's the way I've been using it up until now - esp. with using Admobs in it.. So that could be part of the issue - but I tried to regenerate that, with the Reflection library included, so I don't think it is the issue... It doesn't look like I'm calling the recycle method incorrectly, more that it's just not known or found!!??

Any thoughts?

I'm using an HTC Evo 3D with Android 2.3.4.. although I don't suspect that is the issue either.
 
Last edited:

eps

Expert
Licensed User
Longtime User
Klaus

This is how I'm calling it, probably wrongly!

B4X:
   If panelsgtpro(1).IsInitialized Then
   For i = 0 To panelsgtpro.Length - 1
      panelsgtpro(i).SendToBack
      panelsgtpro(i).RemoveView
      Dim lbl As Label
      lbl.Initialize("gtpro")
      y = i + 1
      Dim Obj1 As Reflector
      Obj1.Target = lbl.Tag & "_side.jpg" ' bmp is the unwanted Bitmap
      Obj1.RunMethod("recycle")
   Next
   End If
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Penny dropped!

For i = 0 To panelslmp2.Length - 1
' panelslmp2(i).RemoveView
panelslmp2(i).SendToBack
' Dim lbl As Label
'panelslmp2(i).GetView(lbl.
y = i + 1

'bmp2.Initialize((File.DirAssets, y & "_side.jpg")
lb1 = panelslmp2(i).GetView(0)
bmp2.Initialize(File.DirAssets, lb1.Tag & "_side.jpg")
Dim Obj1 As Reflector
Obj1.Target = bmp2 ' bmp is the unwanted Bitmap
Obj1.RunMethod("recycle")
Next

works :)
 
Upvote 0

priitp

Member
Licensed User
Longtime User
Hmm???
I have missed something here.

Should we recycle every Bitmap ourself or does GC take care of them?
Any link to types we should Dispose in code?

Thanks
Priit
 
Upvote 0
Top