R RobinInTheHood New Member Mar 9, 2024 #1 Hi, with this simple code I get a the error: java.lang.NullPointerException: Attempt to write to field 'java.lang.String b4a.example.main$_a.r' on a null object reference In Globals: globals: Type a(r As String) Type b(s As a) Type c(t As b) In Activity_Create Activity_Create: Private cc As c cc.Initialize cc.t.s.r="sd" Strange thing is, if I just write: B4X: Private bb As b bb.Initialize bb.s.r="sd" It compiles without errors. I'm confused...
Hi, with this simple code I get a the error: java.lang.NullPointerException: Attempt to write to field 'java.lang.String b4a.example.main$_a.r' on a null object reference In Globals: globals: Type a(r As String) Type b(s As a) Type c(t As b) In Activity_Create Activity_Create: Private cc As c cc.Initialize cc.t.s.r="sd" Strange thing is, if I just write: B4X: Private bb As b bb.Initialize bb.s.r="sd" It compiles without errors. I'm confused...
R RobinInTheHood New Member Mar 9, 2024 #2 Ok, I think I can answer my question. I have to initialize every part of the structure B4X: Private cc As c cc.Initialize cc.t.Initialize cc.t.s.Initialize cc.t.s.r="ss" Upvote 0
Ok, I think I can answer my question. I have to initialize every part of the structure B4X: Private cc As c cc.Initialize cc.t.Initialize cc.t.s.Initialize cc.t.s.r="ss"