Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:50:59+00:00 2026-06-13T08:50:59+00:00

I need to show my current and target locations on google map with max

  • 0

I need to show my current and target locations on google map with max zoom level. Here is my code to show both locations with max zoom. But its zooming to center of both locations and my locations are going out of the sight. I want my both locations should be in view bounds and set the zoom as maximum as possible. Please help me. Thanks in advance.

    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);
    mapMarker = getResources().getDrawable(R.drawable.map_marker);  

    overlayList = mapView.getOverlays();
    myMap = new MyLocationOverlay(this, mapView);
    myMap.enableMyLocation();   

    mapController = mapView.getController(); 

    GeoPoint geoPoint = new GeoPoint((int) (targetLatitude * 1E6), (int) (targetLongitude * 1E6));

    mapController.animateTo(new GeoPoint(((int) (targetLatitude * 1E6) + (int) (currentLatitude * 1E6))/2, ((int) (targetLongitude * 1E6) + (int) (curLongitude * 1E6))/2 )); 
    mapController.zoomToSpan((int)(targetLatitude - currentLatitude), (int)(targetLongitude - curLongitude));

    mapController.setZoom(12);

    OverlayItem overlayItem = new OverlayItem(geoPoint,"xxx", "yyyy");

    CustomPinpoint customPinpoint = new CustomPinpoint(mapMarker, this);
    customPinpoint.insertPinpoint(overlayItem);

    overlayList.clear();
    overlayList.add(myMap);
    overlayList.add(customPinpoint); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:51:00+00:00Added an answer on June 13, 2026 at 8:51 am
        int minLat = Integer.MAX_VALUE;
        int minLong = Integer.MAX_VALUE;
        int maxLat = Integer.MIN_VALUE;
        int maxLong = Integer.MIN_VALUE;
    
        for (GeoPoint point : points) {
            minLat = Math.min(point.getLatitudeE6(), minLat);
            minLong = Math.min(point.getLongitudeE6(), minLong);
            maxLat = Math.max(point.getLatitudeE6(), maxLat);
            maxLong = Math.max(point.getLongitudeE6(), maxLong);
        }
    
        MapController controller = view.getController();
        controller.zoomToSpan(
                           Math.abs(minLat - maxLat), Math.abs(minLong - maxLong));
        controller.animateTo(new GeoPoint((maxLat + minLat) / 2,
            (maxLong + minLong) / 2));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need show a notication modal window.. But since its a fluid layout the
I need to show my current location as the Marker always on the Google
So here is task i need to get done on iOS: Show User's Current
I need to show Toast at the current Activity if it come some updatings
I have this piece of code, and I need to target only the first
I have one application that shows maps. I need to show current position of
We need to show quotes related with the current document. This user story will
I basically need to show some information about the current game in a separate
I am using MKMapView on my application. i need to show current location on
Hai, I have create a iPhone project where I need to show the current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.