I follow my recommendations but here I go in the darkest, I updated the libreies, performed every single step, api keys, libraries, code, but when I run it all goes crashing to give me a mistake.
some birth mistakes, but I also downloaded other examples with the same problem
[QUOTE = "Erel, post: 414611, membro: 1"] Devi aggiungere con il designer. [/ QUOTE]
I design my layout by code but it looks like you are using design, how can I create a drawing for MapFragment and add that view to my code?
I can not now destroy this code to add a map, you need to have a simpler solution using only the code!
B4X:
Dim pMap As Panel
pMap.Initialize("pmap")
panel2.Panel.AddView(pMap,0,0,panel2.Panel.Width,panel2.Panel.Height)
pMap.AddView(MapFragment1,0,0,pMap.Width,pMap.Height)
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Please install Google Play Services.", True)
End If
even following your advice I mistake me by crashing application, but without giving me error in the log
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalRes: C:\Android\extras\google\google_play_services\libproject\google-play-services_lib\res,com.google.android.gms
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private gmap As GoogleMap
Private MapFragment1 As MapFragment
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layout1")
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Please install Google Play Services.", True)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub MapFragment1_Ready
gmap = MapFragment1.GetMap
Dim m1 As Marker = gmap.AddMarker(10, 30, "test")
m1.Snippet = "This is the snippet"
End Sub
Sub MapFragment1_CameraChange (Position As CameraPosition)
End Sub
Sub MapFragment1_Click (Point As LatLng)
End Sub
Sub MapFragment1_LongClick (Point As LatLng)
End Sub
Sub MapFragment1_MarkerClick (SelectedMarker As Marker) As Boolean 'Return True to consume the click
End Sub
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddManifestText( <permission
android:name="$PACKAGE$.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>)
AddApplicationText(<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyD4-rpRwC5L5X-Po1p4cu3XD6Aldn8EYSs"/>)