Android Question [B4xPages] [SOLVED] 'Error occurred on line: 15 (B4XPages)'

Mashiane

Expert
Licensed User
Longtime User
Ola

I'm pulling my hair out right now. I have followed all examples I could find to make my app work and this just does not want to go away.

Someone said, this setting was possibly the cause

B4X:
#IncludeTitle: False

and this should be true, I have set this to all my layouts and in the code, dololo.

How does one sort out this error?
 

josejad

Expert
Licensed User
Longtime User
Sorry, what's the error you're getting?

I'm trying B4XPages now too, and yes, #IncludeTitle is True
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Hum... Can you upload your project?
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
Hi, I was cleaning the project to send to you. When I went to the manifest and cleaned it, the error disappeared.

The thing is, I really need the manifest script for my app to work well with B4XPages. I have added a wish here as that is the issue with the app. It goes back to the #IncludeTitle issue.


I thank you.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Yes, same error here adding that code to the manifest.
But the error is in B4XPages code, not in Main #IncludeTitle: False line.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
Hi @Erel

To provide more clarity on this, there are two cases where this has happened.

Case 1: When

B4X:
#IncludeTitle: False

It raises this error. As soon as this is made True, the error is never raised again.

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 15 (B4XPages)
java.lang.RuntimeException: Object should first be initialized (JavaObject).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
    at anywheresoftware.b4j.object.JavaObject.getCurrentClass(JavaObject.java:258)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:118)
    at b4a.example.issue.b4xnearbypage$ResumableSub_B4XPage_Appear.resume(b4xnearbypage.java:97)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1704)
    at android.os.Handler.handleCallback(Handler.java:888)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:213)
    at android.app.ActivityThread.main(ActivityThread.java:8178)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **

This was not my case per ser as I found this here, https://www.b4x.com/android/forum/t...crashes-when-loading-page-with-drawer.120295/ when I was trying to solve my problem. Only to find that the cause was in my manifest when I was cleaning it to PM to Jose.

Case 2: When

This script is included in the manifest

B4X:
SetActivityAttribute(Main, android:theme, "@style/DarkTheme")
CreateResource(values, theme.xml,
<resources>
   <style name="DarkTheme" parent="android:Theme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:backgroundDimEnabled">false</item>
  </style>
</resources>)

I found this script here in the forum, it helps with hiding the "page" that displays before the Main activity is shown which was then recorded as a wish in. https://www.b4x.com/android/forum/t...ays-before-the-main-activity-is-shown.127093/


Update:

I found this manifest script here, https://www.b4x.com/android/forum/threads/background-activity-transparent.97900/post-617025
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please focus on a single issue. As I wrote, it is very difficult to understand this thread.

The error happens in a page named B4XNearbyPage in the B4XPage_Appear event. You should check the code there.
Tip: don't treat B4XPages as activities. In most cases you don't need to do anything in the Appear and Disappear events.
 
Upvote 0
Top