Android Question Type within Type, NullPointerException

RobinInTheHood

New Member
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...
 

RobinInTheHood

New Member
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…