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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:23:21+00:00 2026-05-19T13:23:21+00:00

I am working on an Android app that already exists on iPhone. In the

  • 0

I am working on an Android app that already exists on iPhone.

In the app, there is a Map activity that has (I counted) around 800 markers in four groups marked by drawable in four different colors. Each group can be turned on or off. Information about markers I have inside List. I create a mapOverlay for each group, then I attach that overlay to the map. I strongly believe that coding part I did properly. But I will attach my code anyway…

The thing is, my Nexus One can’t handle map with all those markers. It takes around 15 seconds just to draw 500 markers. Then when all drawn, map is not quite smooth. It is sort of hard to zoom and navigate around. It can be done, but experience is bad and I would like to see if something can be done there. I know if I avoid String > Double conversion, I could save some time, but I doubt that would be significant.

iPhone seems doesn’t have problems showing all these markers. It takes roughly about 1-2 seconds to show all of them and zooming and panning is not that bad. Slow down is noticeable but still acceptable. I personally think it is no good to draw all those markers, but app is designed by somebody else and I am not supposed to make any drastic changes.

I am not sure what to do here. It seems I will have to come up with different functionality, maybe use GPS location, if known, and draw only markers within some radius, or, if location not known, use center of the screen(map) and draw markers around that. I will have to have reasonable explanation for my bosses in case I make these changes.

I appreciate if anybody has any idas.

And the code:

    List<Overlay> mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.pin_blue);
    drawable = this.getResources().getDrawable(R.drawable.pin_blue);
    ArrList = appState.GetSleepArrList();
    ItemizedOverlay itemizedoverlay = new ItemizedOverlay(drawable, this); 
    ...
    ...
       for (int m = 0; m < ArrList.size(); m++) {
            tName = ArrList.get(m).get("name").toString();
            tId = ArrList.get(m).get("id").toString();
            tLat = ArrList.get(m).get("lat").toString();;
            tLng = ArrList.get(m).get("lng").toString();;
            try {
                lat = Double.parseDouble(tLat);
                lng = Double.parseDouble(tLng);
                p1 = new GeoPoint(
                        (int) (lat * 1E6), 
                        (int) (lng * 1E6));
                OverlayItem overlayitem = new OverlayItem(p1, tName, tId);
                itemizedoverlay.addOverlay(overlayitem);
            } catch (NumberFormatException e) {
                Log.d(TAG, "NumberFormatException" + e);    
            }
        }
        mapOverlays.add(itemizedoverlay);
        mapView.postInvalidate();

…………………………..

public class ItemizedOverlay extends ItemizedOverlay<OverlayItem>
{
    private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
    private Context mContext;
    public HelloItemizedOverlay(Drawable defaultMarker, Context context)
    {
        super(boundCenterBottom(defaultMarker));
        mContext = context;
    }

    public void addOverlay(OverlayItem overlay)
    {
        mOverlays.add(overlay);
        populate();
    }
    @Override
    protected OverlayItem createItem(int i)
    {
        return mOverlays.get(i);
    }
    @Override
    public int size()
    {
        return mOverlays.size();
    }
    @Override
    protected boolean onTap(int index)
    {
        final OverlayItem item = mOverlays.get(index);
                    ... EACH MARKER WILL HAVE ONCLICK EVENT THAT WILL PRODUCE CLICABLE 
                    ... BALOON WITH MARKER'S NAME.          
        return true;
    }       
}    
  • 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-05-19T13:23:22+00:00Added an answer on May 19, 2026 at 1:23 pm

    Well. It turned out I call populate() every time after adding an marker. I took populate() out of addOverlay() method and I am calling it after loop finishes. All markers now show almost instantaneously. The only problem now is that the map is very unresponsive when at lower zoom (showing a lot of markers at once). I don’t see solution for this unless I figure out how to decrease number of markers on the map when map is zoomed out… thinking to group them somehow…. currently working on this…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an Android app that displays multiple markers on a Google
I am working on an android app that has two activities. One is the
I'm working on making an iPhone version of an Android app that I've written
I am working on an android app that has a database in which one
I am working on an Android app that utilizes the Google Maps API MapView,
I'm building an app that has a main Activity that takes advantage of the
I'm working on an Android app that uses high-resolution GPS data. It's designed to
I'm working on an android app that can call upon HP ePrint app to
I'm working on an android app that writes and reads .PNG files from sdcard.
I'm working on an Android app that will look like this (Photoshop mockup): (source:

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.