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 7833487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:43:55+00:00 2026-06-02T12:43:55+00:00

Hi every body iam working with an Android application which contains a Google Map

  • 0

Hi every body iam working with an Android application which contains a Google Map with hundreds of Markers.Here iam able to show all the Markers on the Map.But here my requirement is i have to show only first five markers in the google map with the max zoom level.It is exemption to the markers whose latitude and longitude falls in between the current showing five markers.This requirement is because if there are thousands of markers the map becomes cloudy.Below is my code.

public void displayMapView(final Vector<MapData> retVector){

  mapOverlays=mapView.getOverlays();
  Drawable marker = getResources().getDrawable(R.drawable.map_pin);
  marker.setBounds((int) (-marker.getIntrinsicWidth() / 2),-marker.getIntrinsicHeight(),(int) (marker.getIntrinsicWidth() / 2), 0);
  funPlaces = new MyItemizedOverlay(marker,mapView);
  mapView.getOverlays().add(funPlaces);
  GeoPoint pt = funPlaces.getCenterPt();
  int latSpan=funPlaces.getLatSpanE6();
  int longSpan=funPlaces.getLonSpanE6();
  mc=mapView.getController();
  mc.setCenter(pt);
  mc.zoomToSpan((int)(latSpan*1.5),(int)(longSpan*1.5));
  //mc.zoomToSpan((int)(minLatitude-maxLatitude),(int)(minLatitude-maxLatitude));

}

@Override
protected boolean isLocationDisplayed(){
  return false;
}

@Override
protected boolean isRouteDisplayed(){
  return false;
}

public class MyItemizedOverlay extends BalloonItemizedOverlay<OverlayItem> {
  private ArrayList<OverlayItem> m_overlays = new ArrayList<OverlayItem>();
  @SuppressWarnings("unused")
  private Context c;
  private GeoPoint center = null;   
  public MyItemizedOverlay(Drawable marker,MapView mapView){
    super(boundCenter(marker),mapView);
    c = mapView.getContext();
    try{
        String name="",cusine="",distance="",price="",popUpDataNew="";
        for(int pinret=0;pinret<mpDt.size();pinret++){
          MapData retMapData=(MapData)mpDt.get(pinret);
          resId=retMapData.getId();
          name=retMapData.getName();
          cusine=retMapData.getCusine();
          distance=retMapData.getDistance();
          price=retMapData.getPrice();
          popUpDataNew=name+"/"+cusine+"/"+distance+"/"+price;
          try{
            double lat=Double.parseDouble(retMapData.getLatitude());
            double lon=Double.parseDouble(retMapData.getLongitude());
            GeoPoint pointNew= new GeoPoint((int)(lat*1E6),(int)(lon*1E6)); 
            m_overlays.add(new OverlayItem(pointNew,popUpDataNew,resId));
            populate();
          }catch(NumberFormatException nfe){
           nfe.printStackTrace();
          }
        }
       }catch(Exception e){
         e.printStackTrace();
       }    
  }
  public GeoPoint getCenterPt(){
    if(center == null){
      int northEdge = -90000000;
      int southEdge = 90000000;
      int eastEdge = -180000000;
      int westEdge = 180000000;
      Iterator<OverlayItem> iter = m_overlays.iterator();
      while(iter.hasNext()){
        GeoPoint pt = iter.next().getPoint();
        if(pt.getLatitudeE6() > northEdge)
          northEdge = pt.getLatitudeE6();
        if(pt.getLatitudeE6() < southEdge)
          southEdge = pt.getLatitudeE6();
        if(pt.getLongitudeE6() > eastEdge)
          eastEdge = pt.getLongitudeE6();
        if(pt.getLongitudeE6() < westEdge)
          westEdge = pt.getLongitudeE6();
      }
      center = new GeoPoint((int) ((northEdge + southEdge) / 2),(int) ((westEdge + eastEdge) / 2));
     }
        return center;
  }

Any suggestions are greatly appreciated.

Thanks&Regards,

Venkat

  • 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-02T12:43:57+00:00Added an answer on June 2, 2026 at 12:43 pm

    Change this with

     for(int pinret=0;pinret<mpDt.size();pinret++){ 
    }
    

    this,

     int size = mpDt.size();
     if(size > 5)
        size =5 ;
     for(int pinret=0;pinret<size;pinret++){ 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi every body i am new in iPhone application development. In my application need
I want to make a page for android which is refreshing in every sec
every body! I am new to zend framework, I am working on ajax based
I am working on an android application that uses phonegap/cordova. This app uses a
I am working with an application by using Service class to run the app
I'm working on an ASP.NET MVC 3 application. I primarily come from a ASP.NET
Actually I need to create an event in Google Calendar using my app. Every
Every thing is working great until i try to add a form with ModelForm.
Update :- My updated script is second one and which is working perfect (
I am just learning AJAX, and the following HTML file is not working. Every

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.