Skip to content

Instantly share code, notes, and snippets.

@codeguru42
Created March 8, 2014 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeguru42/9424705 to your computer and use it in GitHub Desktop.
Save codeguru42/9424705 to your computer and use it in GitHub Desktop.
Dynamic Map Fragment
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
GoogleMapOptions options = new GoogleMapOptions()
.mapType(GoogleMap.MAP_TYPE_SATELLITE);
SupportMapFragment mapFragment = SupportMapFragment
.newInstance(options);
GoogleMap map = mapFragment.getMap();
ft.replace(R.id.map, mapFragment);
ft.commit();
List<Country> countries = getCountries();
LatLng point = countries.get(1).lookAt.target;
map.animateCamera(CameraUpdateFactory.newLatLng(point));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment