Hi everyone,
I have a problem with the initialization of mapfragment, I state that I am not using the designer file and I configure the objects manually, using mapfragment as you can see from the code I always get an error, I can not understand how I can do to delete it. If anyone can kindly give me some indication. Thank you.
This is the error Log :
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object anywheresoftware.b4a.objects.collections.Map.Get(java.lang.Object)' on a null object reference
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:191)
at com.google.android.gms.maps.zzac.zzb(com.google.android.gms lay-services-maps@@17.0.1:1)
at com.google.android.gms.maps.internal.zzaq.zza(com.google.android.gms lay-services-maps@@17.0.1:6)
at com.google.android.gms.internal.maps.zzb.onTransact(com.google.android.gms lay-services-maps@@17.0.1:3)
at android.os.Binder.transact(Binder.java:675)
at es.bc com.google.android.gms.dynamite_mapsdynamite@222615067@22.26.15 (100408-0):2)
at com.google.maps.api.android.lib6.impl.bf.run com.google.android.gms.dynamite_mapsdynamite@222615067@22.26.15 (100408-0):1)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object anywheresoftware.b4a.objects.collections.Map.Get(java.lang.Object)' on a null object reference
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:177)
... 13 more
I have a problem with the initialization of mapfragment, I state that I am not using the designer file and I configure the objects manually, using mapfragment as you can see from the code I always get an error, I can not understand how I can do to delete it. If anyone can kindly give me some indication. Thank you.
B4X:
Sub Process_Globals
Private rp As RuntimePermissions
End Sub
Sub Globals
Private panel As Panel
Private mp As MapFragment
End Sub
Sub Activity_Create(FirstTime As Boolean)
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
panel.Initialize("Panel")
Activity.AddView(panel,0,0,100%x,100%y)
mp.Initialize("Map",panel)
wait For Map_Ready
End Sub
Editor Manifest:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
AddManifestText(<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>)
SetApplicationAttribute(android:largeHeap, "true")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, Themes.DarkTheme)
AddApplicationText(
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="....... google api key ......."/>
)
This is the error Log :
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object anywheresoftware.b4a.objects.collections.Map.Get(java.lang.Object)' on a null object reference
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:191)
at com.google.android.gms.maps.zzac.zzb(com.google.android.gms
at com.google.android.gms.maps.internal.zzaq.zza(com.google.android.gms
at com.google.android.gms.internal.maps.zzb.onTransact(com.google.android.gms
at android.os.Binder.transact(Binder.java:675)
at es.bc
at com.google.maps.api.android.lib6.impl.bf.run
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object anywheresoftware.b4a.objects.collections.Map.Get(java.lang.Object)' on a null object reference
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:177)
... 13 more