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:
[CODE lang="b4x" title="globals"] Type a(r As String)
Type b(s As a)
Type c(t As b)[/CODE]

In Activity_Create
[CODE lang="b4x" title="Activity_Create"] Private cc As c
cc.Initialize
cc.t.s.r="sd"[/CODE]

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

Similar Threads

Back
Top