Java Question Java lib error

gerredtor

Active Member
Licensed User
Hello i write a Lib and i become a error, the code:

B4X:
    @SuppressWarnings("static-access")
    public void init(BA a)
    {
        alarmManager = (AlarmManager) a.activity.getSystemService(a.activity.ALARM_SERVICE);
    }

and the error:

B4X:
main_activity_create (java line: 331)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.app.Activity.getSystemService(java.lang.String)' on a null object reference
    at ibe.libs.clock.IBEClock.init(IBEClock.java:23)
    at ibe.apps.wecker.main._activity_create(main.java:331)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at ibe.apps.wecker.main.afterFirstLayout(main.java:102)
    at ibe.apps.wecker.main.access$000(main.java:17)
    at ibe.apps.wecker.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java)
    at android.os.Handler.dispatchMessage(Handler.java)
    at android.os.Looper.loop(Looper.java)
    at android.app.ActivityThread.main(ActivityThread.java)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
 
Top