B4J Question JavaObject stuff shown in the Debugger

Ray Y

Member
I'm using a JavaObject in a project of mine. When I debug the thing, down in the Watch window, it shows the variable I've set to the object. When I expand the tree for it, I see all sorts of values that I'd like to be able to use in my code that aren't specifically documented for the .jar file I'm using. Is there any way I can access those values? They are obviously there somewhere in memory because the Debugger sees them.

I've tried various methods but haven't stumbled upon the correct one yet. Maybe because it's not possible?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The debugger shows all the instance fields including the private fields. In many cases there are methods that allow you to get the fields and those methods should be documented in the relevant library or SDK documentation.

JavaObject cannot access private fields. You can use jReflection to access private fields though you should be careful as private fields are supposed to be private...
 
Upvote 0

Ray Y

Member
Duly noted. Is this like quantum computing where just reading the value changes the machine state, or could I just keep it read-only? (aka Peek() but not Poke() [showing my programming age with that reference])

Thanks in advance for your help.
 
Upvote 0
Top