1

Ok so I have searched the whole internet for a solution, but I had no luck finding the right answer. So I thought, why not just post the question myself.

So my situation is as follows: I am using the Google Maps API V2 for Android. It's working like a charm as it is right now, but I have to limit panning for only the location that I am using.

I am using Android Studio.

I have already made a beginning to make this possible, but I have no clue how I must continue from here.

I hope somebody can help me with this matter.

Thanks in advance!

private void setUpMap() {

    /** this is where I made the beginning of the boundary settings **/

    LatLng northEast = new LatLng(52.36060,4.886150);
    LatLng southWest = new LatLng(52.35940, 4.884000);
    LatLngBounds myBoundary = new LatLngBounds(southWest , northEast );
    LatLng mapCenter= new LatLng(52.360011, 4.885216);
    LatLng myLocation= new LatLng(52.360011, 4.885216);

    /** end of boundary settings **/

    mMap.setBuildingsEnabled(true);
    mMap.setMyLocationEnabled(false);

    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(myLocation)             // Sets the center of the map to Mountain View
            .zoom(19)                   // Sets the zoom
            .bearing(90)                // Sets the orientation of the camera to east
            .tilt(30)                   // Sets the tilt of the camera to 30 degrees
            .build();                   // Creates a CameraPosition from the builder

    mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
Shin
  • 11
  • 3

0 Answers0