I have an problem, i want to display the GoogleMap into an Fragment. But when starting the app, the Map stays black. Only the little Google Logo is shown. So im doing it like this :
public class AndroidLauncher extends AndroidApplication implements RequestHandler,LocationListener,
GoogleApiClient.ConnectionCallbacks, OnMapReadyCallback {
private MapFragment mMapFragment;
public GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
mMapFragment = ((MapFragment) getFragmentManager().findFragmentById(R.id.map));
if (mMapFragment == null) {
mMapFragment = (MapFragment) MapFragment.newInstance();
mMapFragment.getMapAsync(this);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
// flMap.getID(); returns the FrameLayout ID.
fragmentTransaction.replace(flMap.getId(), mMapFragment, MAP_FRAGMENT_TAG);
fragmentTransaction.commit();
}
}
@Override
public void onMapReady(GoogleMap gMap) {
googleMap = gMap;
if (googleMap != null) {
final LatLng markerPosition = new LatLng(26.9124857, -101.4180168);
googleMap.addMarker(new MarkerOptions().position(markerPosition)).showInfoWindow();
}
}
I only posted the most important stuff, there more, like an Layer for sprites, but i think thats not the problem...
When i start the app, my map looks black like this :
Whats wrong with it :/ ? I already added the API key like this in the manifest :
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />