Android Question Why this error?

persianpowerman1

Active Member
Licensed User
Longtime User
Guys.. i get this in my LogTab...
but my application just comes on shows me an error message and then its a Force Close?!

any idea why does this happen???


----------------------------------------------------
maininitializeProcessGlobals (java line: 418)
java.lang.RuntimeException: java.lang.NullPointerException
at My.Block.main.initializeProcessGlobals(main.java:418)
at My.Block.main.afterFirstLayout(main.java:94)
at My.Block.main.access$100(main.java:16)
at My.Block.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:587
error Message.jpg
)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4123)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.BA.<init>(BA.java:101)
at ADR.stringdemo.stringfunctions.innerInitialize(stringfunctions.java:12)
at ADR.stringdemo.stringfunctions._initialize(stringfunctions.java:227)
at My.Block.listener._process_globals(listener.java:149)
at My.Block.main.initializeProcessGlobals(main.java:415)
... 12 more
------------------------------------------------------
 

persianpowerman1

Active Member
Licensed User
Longtime User
hi man,
in the service i have..
B4X:
Sub Process_Globals
   
    Dim sNotif As Notification
    Dim PE As PhoneEvents
    Dim PhoneId As PhoneId
   
    Dim sf As StringFunctions
    sf.Initialize
End Sub

and in the main activity i have.. nothing .. but in
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
   
    Dim btnToggle As ToggleButton
    Dim lblState As Label
    Dim ListView1 As ListView
    Dim Button1 As Button
   
End Sub

the funny thing is when i restart my phone or emulator... i can see its notification(part of the code is to put the notification) in the drawer.. and then it works fine!!!

but the moment i close that.. and re run it.. it gives this error... any idea buddy
 
Upvote 0

persianpowerman1

Active Member
Licensed User
Longtime User
WOW! brilliant buddy!! just brilliant!!!

i couldnt set break points on the Process_Globals... so put them on Activity_Create... and noticed... the error msg.. still came even before it reached the break point...

BUT... the moment i removed
sf.Initialize


... it ran perfect.. thanx man thanx a million... what do you think .. why does this happen?
 
Upvote 0
Top