Created
March 8, 2014 03:04
-
-
Save codeguru42/9424705 to your computer and use it in GitHub Desktop.
Dynamic Map Fragment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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