Android Question How do you use javaobject initializecontext in B4XPages

mcqueccu

Expert
Licensed User
Longtime User
I have this ACTIVITY project which has the InitializeContext code, working fine, but when I moved to B4XPages, I got error message

B4X:
dim nativeme as javaobject
nativeme.InitializeContext

Now I want to convert the project to B4XPages, but it seems the initializecontext is not working.

B4X:
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Error occurred on line: 34 (B4XMainPage)
java.lang.RuntimeException: Method: getAndroidID not found in: b4a.example.main
    at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:389)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:139)
    at b4a.example.b4xmainpage._showlogs(b4xmainpage.java:121)
    at b4a.example.b4xmainpage._button1_click(b4xmainpage.java:107)
    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:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:8083)
    at android.view.View.performClickInternal(View.java:8060)
    at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
    at android.view.View$PerformClick.run(View.java:31549)
    at android.os.Handler.handleCallback(Handler.java:995)
    at android.os.Handler.dispatchMessage(Handler.java:103)
    at android.os.Looper.loopOnce(Looper.java:248)
    at android.os.Looper.loop(Looper.java:338)
    at android.app.ActivityThread.main(ActivityThread.java:9067)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
** Activity (main) Pause event (activity is not paused). **
 

Attachments

  • DeviceInformation.zip
    10.6 KB · Views: 2
  • DeviceInfo_B4XPages.zip
    15.5 KB · Views: 4
Top