Android Question Crashes accessing google play achievements

andymc

Well-Known Member
Licensed User
Longtime User
I'm getting a null pointer exception error from this code:

Sub GP_onAchievementsLoaded(Result As Map)
Private StatusCode As Int = Result.Get(Achievements.RESULTMAP_STATUS_CODE)
If StatusCode <> Achievements.STATUS_OK Then
'The loading failed
Log("Load: Error=" & StatusCode)
Return
End If
Log("Achievements Loaded")
'Gets the list of achievements
gAL = Result.Get(Achievements.RESULTMAP_ACHIEVEMENTS)
For Each ach As GPlayAchievement In gAL
Log(ach.Description)
Next
End Sub

It's the line Result.Get(Achievements.RESULTMAP_STATUS_CODE) that causing the issue:

java.lang.NullPointerException:

at uk.co.coffeeinducedgames.invaders.main._gp_onachievementsloaded (main.java:2371)

at java.lang.reflect.Method.invoke (Native Method)

at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:186)

at flm.b4a.googleplay.PendingResultWrapper.RaiseEvent (PendingResultWrapper.java:230)

at flm.b4a.googleplay.PendingResultWrapper.access$0 (PendingResultWrapper.java:226)

at flm.b4a.googleplay.PendingResultWrapper$LoadAchievementsEvent.onResult (PendingResultWrapper.java:355)

at flm.b4a.googleplay.PendingResultWrapper$LoadAchievementsEvent.onResult (PendingResultWrapper.java:1)

at com.google.android.gms.internal.zzbbg.handleMessage (Unknown Source:51)

at android.os.Handler.dispatchMessage (Handler.java:109)

at android.os.Looper.loop (Looper.java:207)

at android.app.ActivityThread.main (ActivityThread.java:7470)

at java.lang.reflect.Method.invoke (Native Method)

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:958)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…