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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:14:10+00:00 2026-05-23T23:14:10+00:00

So I am extending an ItemizedOverlay, and using a rest query to make an

  • 0

So I am extending an ItemizedOverlay, and using a rest query to make an async http request to web service where I can get the coordinates of lots of push pins.

Once the handler gets the async http request I do the following (maybe not the best solution – ie. clearing all records all the time). But I am open to suggestions (hence the post)..

Basically here is the code flow (I have a list view & map view on a flipper and want to keep them in sync – hence the arrayAdapter;

locationRecords.clear(); // ArrayList<LocationRecord>
updateScreen(jArray); // jSONArray jArray
arrayAdapter.notifyDataSetChanged();
updateOverlay();


private synchronized void updateOverlay() {

// Clear the previous overlay of map push pins (don't want to keep adding new overlays)
       Iterator<Overlay> listofOverlays = mapView.getOverlays().iterator();
   while (listofOverlays.hasNext()) {
         Overlay tempOverlay = listofOverlays.next();
         if (tempOverlay.getClass().equals(MunzeeOverlay.class)) {
            mapView.getOverlays().remove(tempOverlay);
         }
            this.notify();
    }

    MyOverlay overlay = new MyOverlay(MapTools.getGreenMarker(mContext),mapView);

    Iterator<LocationRecord> mapList = locationRecords.iterator();  
    while (mapList.hasNext()) { 
        overlay.addOverlay(mapList.next().getOverlayItem()); 
    }

    mapView.getOverlays().add(overlay);
  }

  protected void updateScreen(JSONArray jArray) {
        if ( jArray != null ) {
          for ( int i = 0; i < jArray.length(); i++ ) {
            try {
                JSONObject myArray = jArray.getJSONObject(i);
            locationRecords.add(new LocationRecord(myArray,mContext));
        } catch (JSONException e) {     
            e.printStackTrace();
        }
           }
        }
  }

My thought is on the myOverlay that I can do a check when I addOverlay w/ an equiv check and make sure it is not already there, that way i would not need to delete the overlay on the map?

I also am seeing some ConcurrentModificationExceptions in updateOverlay (I suppose that could have to do w/ clearing the locationRecords & updatingScreen not in a synchronized manner.. Sooo..

1) Any suggestions for improving map pin performance, and not seeming to freeze the map while it is updating the overlay

2) Any suggestions on fixing the ConcurrentModificationExceptions?

  • 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-23T23:14:11+00:00Added an answer on May 23, 2026 at 11:14 pm
    1. Have one overlay with N pins. Near as I can tell, you have N overlays with one pin each. This is bad.

    2. When your data arrives, call populate() on the one-and-only overlay to have Android reload all of the markers — you do not need to clear anything yourself.

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

Sidebar

Related Questions

I am extending a template class using C++ in Visual Studio 2005. It is
I am extending the Visual Studio 2003 debugger using autoexp.dat and a DLL to
I'm extending PDO and I want to throw exceptions from it. Should I make
One of my website extending http://digitarald.de/project/autocompleter/ plugin for autosuggest Country, State and City. Eg:
I've been searching long for clear informations about the right way of extending ItemizedOverlay
When extending with doLayout you can only have one sub-template, but you can include
I have a component extending a Spark List, and when I scroll using the
I'm using extending application class on Android to share my data across the entire
I'm extending an entities' partial class to have a method. How do I get
extending the question I had asked earlier which can be found here, plotting multiple

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.