emen emen - 1 year ago 70
Android Question

How to restrict android google map to a city?

How can i restrict android google map to a city?
I am currently following code for show google map:

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}


I want to show just a city. Any way?

Answer Source
private static final LatLngBounds DUBAI_BOUNDS = new LatLngBounds(new LatLng(24.5908366068, 54.84375),
            new LatLng(25.3303729706, 55.6835174561));


map.setLatLngBoundsForCameraTarget(DUBAI_BOUNDS);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download