Android : MapView (Maps V2) not working

on Tuesday, September 23, 2014


Welcome all


The tiles of the map are not being updated, the only way to update them is to block the device (onPause called) and to unblock the device (onResume called). If i do that, the tiles become updated.... it is very strange


i mean that if i move the finger doing zoom or moving the map, the map is frozen, and it only reresh it's state when i block and unblock the device


all the permissions are fine and the api key also is fine in the manifest


this is my code:



public class MainActivity extends Activity {
MapView map;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout main = new LinearLayout(this);
main.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));

GoogleMapOptions options = new GoogleMapOptions();
options.mapType(GoogleMap.MAP_TYPE_SATELLITE)
.compassEnabled(false)
.rotateGesturesEnabled(false)
.tiltGesturesEnabled(false);

options.camera(new CameraPosition(new LatLng(0, 0), 1, 0, 0));

map = new MapView(this, options);
map.onCreate(savedInstanceState);
main.addView(map);

setContentView(main);
}

@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
map.onResume();
}

@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
map.onPause();
}


}

0 comments:

Post a Comment