java - Google Map object returned as null on certain devices -
I am using the following code to start the Google Maps object:
If (googleMap == faucet) {googleMap = (SupportMapFragment) getSupportFragmentManager () FindFragmentById (R.id.map)). GetMap (); }
This works fine but on some devices, the GoogleMap object is shown as blank. How do I work around this?
I broke the single line code in this form: / P>
the Fergment Manager fmanager = getSupportFragmentManager (); Piece slice = fmanager.findFragmentById (RID.map); SupportMapFragment supportmapfragment = (SupportMapFragment) piece; Googlemap = supportmapfragment.getMap ();
The last line supportmapfragment.getMap ()
is that which gives blank.
My xml file:
& lt; LinearLayout 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: orientation = "vertical" & gt; & Lt; TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "store locator" Android: layout_gravity = "center_horizontal" Android: textSize = "40px" /> & Lt; Fragment android: id = "@ + id / map" Android: name = "com.google.android.gms.maps.SupportMapFragment" Android: layout_width = "match_parent" Android: layout_height = "200px" / & gt; & Lt; ListView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: id = "@ + id / list_categories" /> & Lt; / LinearLayout & gt;
Comments
Post a Comment