I have a mapview in my appn. I show some points on the map when the page gets loaded. I also have a search button in that page. So after I give something to search and click search button, map doesnt gets refr开发者_Go百科eshed. It gets refreshed only when we touch anywhere on the map. I have given mapview.invalidate() also. Still not working...
Any idea why this problem occurs?
We have to give..
mapview.invalidate()
I had some problem while displaying overlays. So it didnt work earlier. Now its perfectly working..
Instead of a MapView use the SupportMapFragment
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/lite_map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="80dp" />
Then init a fragment and get your map with getMapAsync() method:
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.lite_map);
mapFragment.getMapAsync(this);
The next implementation is the same as with a MapView - process a callback method onMapReady:
@Override
public void onMapReady(GoogleMap googleMap) {
map = googleMap;
updateMapCoordinates();
}
精彩评论