Hallo alle ich habe alle Lösungen von stackoverflow durchlaufen, aber kann keine Lösung unter ihnen finden.Ich bin nicht in der Lage, den Marker in map.All die freie Hauptdatei Inhalt habe ich geschrieben zu sehen unten. Hier ist meine Haupttätigkeit: -Hersteller zeigt nicht in Google Karte
public class MainActivityextends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
LatLng sydney = new LatLng(22.7595, 75.9187);
mMap.addMarker(new MarkerOptions().position(sydney).title("Vijay Nagar"));
// mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
Xml File:-
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment" />
Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lalit.maptest" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA8apU-Fh7PxM9HIL27N8bqzdfpeZaPujQ"/>
</application>
</manifest>
Kommentare aus 'mMap.moveCamera (CameraUpdateFactory.newLatLng (sydney));' entfernen. Sie sehen den Marker als Karte animiert an der Markerposition. –
ist deine Karte bereit? –
ja die Methode wird aufgerufen –