Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Android Google Maps API v2 map to show whole world map?

I am developing an android application that uses a google map in the background. When I start the application, I want to display a map of the hole word. According to the android google maps API v2: https://developers.google.com/maps/documentation/android/views the way to set a specific zoom value is "CameraUpdateFactory.zoomTo(float)" and the same api https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/CameraUpdateFactory#zoomTo(float) tells that the minimum argument to this function is 2. but when I call the function: mMap.moveCamera(CameraUpdateFactory.zoomTo(2)); The viewport of the world map is just a little bigger than Australia... How can I display the entire world map at once?

PS: for this experience I am using the google sample code, more specifically, the "MarkerDemoActivity.java"

Thanks in advance, João

like image 867
Joao Avatar asked Dec 08 '12 17:12

Joao


1 Answers

We can cover the whole map in android by using this code:

<com.google.android.gms.maps.MapView
            xmlns:map="http://schemas.android.com/apk/res-auto"               
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"         
            map:cameraZoom="1" //or 0
            map:liteMode="true"
             />
like image 107
Pooja Soni Avatar answered Oct 19 '22 23:10

Pooja Soni