B4J Question Object should first be initialized (B4XView).

johnmie

Active Member
Licensed User
Longtime User
since yesterday I get this fatal error: java.lang.RuntimeException: Object should first be initialized (B4XView).
when trying to access E1.TextArea1.Text, even after E1 is declared in Class_Globals and initialized under B4XPage_Created.
How can I fin out WHICH B4XView is missing or not initialized?

Thanks for advice, john m.
 

josejad

Expert
Licensed User
Longtime User
How can I fin out WHICH B4XView is missing or not initialized?
Checking your code carefully.

We can‘t do it because we don’t know your code. Post your code or upload a small project reproducig the problem.
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
Thank you for Checking your code carefully.
That's exactly what I've been doing for the last two days, checking if everything is properly declared and initialized and setting various breakpoints.
And I still get this error when trying to access E1.TextArea1.text:
B4X:
E1.TextArea1.Text
Error occurred on line: 387
java.lang.RuntimeException: Object should first be initialized (B4XView).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:49)
    at anywheresoftware.b4a.objects.B4XViewWrapper.getNodeObject(B4XViewWrapper.java:120)
    at anywheresoftware.b4a.objects.B4XViewWrapper.getText(B4XViewWrapper.java:318)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$1.run(BA.java:233)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)

Baffeled by the word AbsObjectWrapper I may have to check the location of Java as in previous versions in other Subdirectories this never happened.

Best,
john m.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Thank you for Checking your code carefully.

Sorry if that sounded rude, I didn't mean it that way. What I'm trying to tell you, is we can't know what's happening without seeing the code. The only thing we can see is that editText, in some point is not initialized, but we don't know why without seeing the code.

 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
José: In the meantime I messed things up royally myself.
Klaus: The linenumber is in the B4J code.

Will restarted from an earlier autobackup that worked.

I was only trying to find out if there was an easy way to pinpoint the exact reason and location for the error instead of rudimentary statement like Object should first be initialized (B4XView) as this is not the first time this happens, particularly when creating copies for test purposes.

Nevertheless, thanks for all your help.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
I was only trying to find out if there was an easy way to pinpoint the exact reason and location for the error instead of rudimentary statement like
Maybe this is so obvious... (again) but compare the old version with the new one...
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
I found the solution in one of Klaus's booklets. I've already used it in another situation, but could get it to work if the target is in the B4XMainPage.
With the textarea in page2 I was not able to modify it from page3.
BUT I built a workaround and can now continue.
Thank you, john m.
 
Upvote 0
Top