Android fail to load google map in fragment -


I'm trying to use Google Maps in a piece, but I have a problem that I do not understand is.

I have not come to load the map in this line:

  gMap = (SupportMapFragment) getFragmentManager () FindFragmentById (R.id.map)). GetMap ();  

This row is always empty ...

I tried SupportMapFragment to use MapMapramement, but this is not possible.

How to solve it?

To explain why I want to show it in a piece, that's because I am using a navigation drawer, and one of my items needs to show the map.

Thx,

Edit: My xml:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Fragment xmlns: Android = "http://schemas.android.com/apk/res/android" Android: id = "@ + ID / map" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: name = "Com.google.android.gms.maps.MapFragment" />  

I think you should call with getsupportFragmentManager getFragmentManager otherwise it will always return the redundant


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -