Empty MapView in RecyclerView

Viewed 299

I try to build a Chat Application in wich it should be possible for the user to send his location. I can pick the location via a PlcaPicker, this is all working fine. But when I try to display the Location in my MapView, it is empty without any Google Logo or Google Maps Symbol. My Code for displaying the Location:

viewholder.mymap.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
      LatLng coordinates = new LatLng(43.535027499999984, 11.17666015625001);
      MapsInitializer.initialize(Chat_Room.this);
      googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
      googleMap.addMarker(new MarkerOptions().position(coordinates));
      googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(coordinates,13));
      viewholder.mymap.onResume();
}                                                                         
});

And my MapView:

<com.google.android.gms.maps.MapView
android:id="@+id/mymap"
android:layout_width="250dp"
android:layout_height="200dp"
android:layout_alignParentEnd="true"/>

I read that I can also use a Fragment but I dont know how to implement it and why my code is not working.

EDIT

My Manifest

<manifest>
  <application>
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="my api key" />
  </application>
  <uses-feature
      android:glEsVersion="0x00020000"
      android:required="true" />
</manifest>

UPDATE

When I use a Fragment like this:

<fragment
    android:id="@+id/mymap"
    android:layout_width="250dp"
    android:layout_height="200dp"
    android:layout_alignParentEnd="true"
    map:cameraZoom="13"
    map:mapType="normal"
    class="com.google.android.gms.maps.SupportMapFragment"
    map:liteMode="true"/>

It shows the Google Logo on the left bottom corner, but I think my problem now is that my Adapter for my Recyclerview can't find the MapFragment, so it does not show anything. How can I find the MapFragment in my RecyclerAdapter?

0 Answers
Related