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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:41:18+00:00 2026-06-01T02:41:18+00:00

//get the lat and loni throgh the loaddata function.java.util.ConcurrentModificationException at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:64) How to resolve

  • 0

//get the lat and loni throgh the loaddata function.java.util.ConcurrentModificationException at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:64) How to resolve it?Somebody said use Iterator.

public void loaddata()
 {
     try
     {

            lat = new String[vechno.length];
            lon=new String[vechno.length];
            for(int i=0;i<vechno.length;i++)
            {

                if(Integer.parseInt(vechspeed[i].trim())==0||vechspeed[i].trim()=="")
                {
                    latiloni=call2(vechno[i].toString());
                    lat[i]=latiloni[0];
                    lon[i]=latiloni[1];
                    GeoPoint point1 = new GeoPoint((int)(Double.parseDouble(lat[i])*1E6),(int)(Double.parseDouble(lon[i])*1E6));
                    OverlayItem overlayItem = new OverlayItem(point1,"Vehicle No : "+vechno[i]+"(Idle)", 
                            "Located           : "+vechloc[i]+"\n"+"Speed(kmph) : "+vechspeed[i]+"\n"+"Address           : "+vechadd[i]);
                    itemizedOverlay0.addOverlay(overlayItem);
                    final MapController mc = mapView.getController();
                    mc.animateTo(point1);
                    mc.setZoom(6);
                    mapOverlays.add(itemizedOverlay0);


                }
                else
                if(Integer.parseInt(vechspeed[i].trim())>=1&&Integer.parseInt(vechspeed[i].trim())<=20)
                {
                    latiloni=call2(vechno[i].toString());
                    lat[i]=latiloni[0];
                    lon[i]=latiloni[1];
                    GeoPoint point2 = new GeoPoint((int)(Double.parseDouble(lat[i])*1E6),(int)(Double.parseDouble(lon[i])*1E6));
                    OverlayItem overlayItem = new OverlayItem(point2,"Vehicle No : "+vechno[i]+"(Running)", 
                            "Located           : "+vechloc[i]+"\n"+"Speed(kmph) : "+vechspeed[i]+"\n"+"Address           : "+vechadd[i]);
                    itemizedOverlay1.addOverlay(overlayItem);
                    final MapController mc = mapView.getController();
                    mc.animateTo(point2);
                    mc.setZoom(6);
                    mapOverlays.add(itemizedOverlay1);

                }
                else
                if(Integer.parseInt(vechspeed[i].trim())>=21&&Integer.parseInt(vechspeed[i].trim())<=40)
                {
                        latiloni=call2(vechno[i].toString());
                        lat[i]=latiloni[0];
                        lon[i]=latiloni[1];
                        GeoPoint point3 = new GeoPoint((int)(Double.parseDouble(lat[i])*1E6),(int)(Double.parseDouble(lon[i])*1E6));
                        OverlayItem overlayItem = new OverlayItem(point3,"Vehicle No : "+vechno[i]+"(Running)", 
                                "Located           : "+vechloc[i]+"\n"+"Speed(kmph) : "+vechspeed[i]+"\n"+"Address           : "+vechadd[i]);
                        itemizedOverlay2.addOverlay(overlayItem);
                        final MapController mc = mapView.getController();
                        mc.animateTo(point3);
                        mc.setZoom(6);
                        mapOverlays.add(itemizedOverlay2);

                }
                else
                if(Integer.parseInt(vechspeed[i].trim())>=41&&Integer.parseInt(vechspeed[i].trim())<=60)
                {
                        latiloni=call2(vechno[i].toString());
                        lat[i]=latiloni[0];
                        lon[i]=latiloni[1];
                        GeoPoint point4 = new GeoPoint((int)(Double.parseDouble(lat[i])*1E6),(int)(Double.parseDouble(lon[i])*1E6));
                        OverlayItem overlayItem = new OverlayItem(point4,"Vehicle No : "+vechno[i]+"(Running)", 
                                "Located           : "+vechloc[i]+"\n"+"Speed(kmph) : "+vechspeed[i]+"\n"+"Address           : "+vechadd[i]);
                        itemizedOverlay3.addOverlay(overlayItem);
                        final MapController mc = mapView.getController();
                        mc.animateTo(point4);
                        mc.setZoom(6);
                        mapOverlays.add(itemizedOverlay3);

                }
                else
                if(Integer.parseInt(vechspeed[i].trim())>=61&&Integer.parseInt(vechspeed[i].trim())<=80)
                {
                        latiloni=call2(vechno[i].toString());
                        lat[i]=latiloni[0];
                        lon[i]=latiloni[1];
                        GeoPoint point5 = new GeoPoint((int)(Double.parseDouble(lat[i])*1E6),(int)(Double.parseDouble(lon[i])*1E6));
                        OverlayItem overlayItem = new OverlayItem(point5,"Vehicle No : "+vechno[i]+"(Running)", 
                                "Located           : "+vechloc[i]+"\n"+"Speed(kmph) : "+vechspeed[i]+"\n"+"Address           : "+vechadd[i]);
                        itemizedOverlay4.addOverlay(overlayItem);
                        final MapController mc = mapView.getController();
                        mc.animateTo(point5);
                        mc.setZoom(6);
                        mapOverlays.add(itemizedOverlay4);

                }
                else
                if(Integer.parseInt(vechspeed[i].trim())>=81&&Integer.parseInt(vechspeed[i].trim())<=120)
                {

                        latiloni=call2(vechno[i].toString());
                        lat[i]=latiloni[0];
                        lon[i]=latiloni[1];
                        GeoPoint point6 = new GeoPoint((int)(Double.parseDouble(lat[i])*1E6),(int)(Double.parseDouble(lon[i])*1E6));
                        OverlayItem overlayItem6 = new OverlayItem(point6,"Vehicle No : "+vechno[i]+"(Running)", 
                                "Located           : "+vechloc[i]+"\n"+"Speed(kmph) : "+vechspeed[i]+"\n"+"Address           : "+vechadd[i]);
                        itemizedOverlay5.addOverlay(overlayItem6);
                        final MapController mc = mapView.getController();
                        mc.animateTo(point6);
                        mc.setZoom(6);
                        mapOverlays.add(itemizedOverlay5);

                }
                else
                if(Integer.parseInt(vechspeed[i].trim())>=120&&Integer.parseInt(vechspeed[i].trim())<=150)
                {
                        latiloni=call2(vechno[i].toString());
                        lat[i]=latiloni[0];
                        lon[i]=latiloni[1];
                        GeoPoint point7 = new GeoPoint((int)(Double.parseDouble(lat[i])*1E6),(int)(Double.parseDouble(lon[i])*1E6));
                        OverlayItem overlayItem = new OverlayItem(point7,"Vehicle No : "+vechno[i]+"(Running)", 
                                "Located           : "+vechloc[i]+"\n"+"Speed(kmph) : "+vechspeed[i]+"\n"+"Address           : "+vechadd[i]);
                        itemizedOverlay6.addOverlay(overlayItem);
                        final MapController mc = mapView.getController();
                        mc.animateTo(point7);
                        mc.setZoom(6);
                        mapOverlays.add(itemizedOverlay6);

                }   

            }
            mapView.invalidate();
     }
     catch(Exception e)
     {

     }

 }
 protected void dosomthing()
 {
        progressdialog1=ProgressDialog.show(Mapping.this, "", "Loading.Please wait...");
        Runnable threadTask = new Runnable() {

            @Override
            public void run() {

                while(true){
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    loaddata();
                    messageHandler.sendEmptyMessage(0);

                }
            }
        };
        (new Thread(threadTask)).start();
 }
  • 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-01T02:41:19+00:00Added an answer on June 1, 2026 at 2:41 am

    It is difficult to see exactly where the exception is coming from, and I suspect that it is not actually in the code you are showing us. If you provided a full stack trace, highlighted the lines in your code that correspond to the line numbers in the trace, we could maybe track it down.


    So what causes ConcurrentModificationExceptions? Well basically, they happen when a collection is modified while an Iterator for the collection is being used; e.g. like this:

        List<String> l = ...
        for (String s : l) {
            if (s.equals("42")) {
                l.add("43");
            }
        }
    

    is likely to throw a CME on the 2nd line if it ever finds a "42". The way to avoid CMEs is to not modify collections while iterating them … or while some other thread might be iterating them.

    There are a couple of ways to get around this:

    • The ConcurrentCxxx collection classes provide iterators that won’t throw a CME. The downside is that they are a more expensive for normal (single-threaded) use than the analogous java.util implementation classes.

    • If you are iterating the list in order to remove elements, you can do this using the Iterator.remove() method; e.g.

      List<String> l = ...
      Iterator<String> it = l.iterator();
      while (l.hasNext()) {
          String s = it.next();
          if (s.equals("42")) {
              l.remove();   // removes the string returned by last call to next()
          }
      }
      

      However, this only works for this particular use-case. You can’t add or replace list elements like this.

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

Sidebar

Related Questions

I need to geocode adresses (get lat/long from addresses) using in .Net, to store
i have a function to calculate several different values: int ASPfile::get_dimensions(int* Lat, int* Lon,
I need to get the distance from a lat/lng point to a line. Of
Is it possible to get position inside the OpenLayers container from a lat/long point?
I have to get routing direction i.e. all the lat-long location between two location
I have a DB full of addresses I need to get lat and long
Get location(lat/long) without GPS, just like my location feature in Google maps. I have
I'm trying to get the LAT/LON position of the mouse in a Windows Forms
I have some problem to get lat/lng from google map in my application. When
I am not able to find out how to get lat-lon values of all

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.