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

  • Home
  • SEARCH
  • 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 9022975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:38:57+00:00 2026-06-16T05:38:57+00:00

Here is a summary of the problem: I have a class called BusLocator which

  • 0

Here is a summary of the problem:

I have a class called BusLocator which tracks the location of a bus.
Right now I’m getting my input from a text file.

The program starts off fine, then it will randomly stop when the bus reaches the end of the screen, or when I try to see something else.

Here are my errors:

12-10 08:28:43.014: E/AndroidRuntime(15257): FATAL EXCEPTION: main
12-10 08:28:43.014: E/AndroidRuntime(15257): java.util.ConcurrentModificationException
12-10 08:28:43.014: E/AndroidRuntime(15257):    at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:569)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:41)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at com.google.android.maps.MapView.onDraw(MapView.java:532)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.View.draw(View.java:13707)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.View.draw(View.java:13591)
 12-10 08:28:43.014: E/AndroidRuntime(15257):   at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.View.draw(View.java:13589)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.View.draw(View.java:13710)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.widget.FrameLayout.draw(FrameLayout.java:467)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.View.draw(View.java:13591)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.View.draw(View.java:13589)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at  android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.View.draw(View.java:13710)
 12-10 08:28:43.014: E/AndroidRuntime(15257):   at android.widget.FrameLayout.draw(FrameLayout.java:467)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at  com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2211)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2281)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2177)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2045)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1854)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at  android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at    android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.Choreographer.doFrame(Choreographer.java:532)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.os.Handler.handleCallback(Handler.java:725)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at android.os.Looper.loop(Looper.java:137)
 12-10 08:28:43.014: E/AndroidRuntime(15257):   at    android.app.ActivityThread.main(ActivityThread.java:5039)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at java.lang.reflect.Method.invokeNative(Native Method)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at java.lang.reflect.Method.invoke(Method.java:511)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-10 08:28:43.014: E/AndroidRuntime(15257):    at dalvik.system.NativeStart.main(Native Method)
12-10 08:28:45.464: D/dalvikvm(15257): GC_CONCURRENT freed 1479K, 21% free 6387K/7988K, paused 18ms+214ms, total 568ms
12-10 08:28:46.034: I/Process(15257): Sending signal. PID: 15257 SIG: 9

The code which reads the coordinates of the bus runs on a separate thread, which is the following:

    class BusThread extends Thread {
private boolean run = true;
private Context context;
    BusLocator bus;

public BusThread(Context context,BusLocator bl) {
    this.context = context;
    this.bus=bl;
}

public void negateRun() {
    run = false;
}

public void run() {
    try {
        AssetManager am = context.getAssets();
        InputStream is = am.open("test.txt");
        Scanner scan = new Scanner(is);
        double longitude;
        double latitude;
        while (run) {
            if (scan.hasNext()) {
                latitude = scan.nextDouble();
                longitude = scan.nextDouble();
                bus.updateBusLoc(longitude,latitude);
                //Pause for 2 seconds
                Thread.sleep(2000);
            }
            else
                scan.reset();
        }

    } catch (IOException ioe) {

        ioe.printStackTrace();
        return;
    } catch (InterruptedException ie) {
        // TODO Auto-generated catch block
        ie.printStackTrace();
        return;
    }
}

}

and lastly, where my error may be coming from, although I wouldnt know why:

public void updateBusLoc(double longi,double lati){
    if(!onScreen){
        onScreen=true;
        GeoPoint point = new GeoPoint((int)(lati*1E6),(int)(longi*1E6));
    busOverlay.addOverlay(new OverlayItem(point, busTitle, busText));
    mapView.getOverlays().add(busOverlay);
    }
    else
    {
        GeoPoint point = new GeoPoint((int)(lati*1E6),(int)(longi*1E6));
        busOverlay.replaceLastOverlay(new OverlayItem(point,busTitle, busText));
        mapView.getOverlays().add(busOverlay);
    }
    mapView.refreshDrawableState();
}

I’m getting pretty desparate… Looking at this for a few hours now. Any help would be most appreciated!

  • 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-16T05:38:59+00:00Added an answer on June 16, 2026 at 5:38 am

    It is very clear from java.util.ConcurrentModificationException exception that in one thread your program is modifying the ArrayList (i.e. you are adding new Overlay) while the same list is being iterated by a separate thread (i.e. calling mapView.refreshDrawableState() to force a View to re-draw, which in turn iterate through the list of added overlays)- Which as per Java docs is not allowed, ref: ConcurrentModificationException

    So what you can try is to re-write your code in such a way that, first add all available overlays and then call mapView.refreshDrawableState()

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

Sidebar

Related Questions

Here's my problem: there's an internal issue tracking system that has a nice summary
Here is my simple User POCO class: /// <summary> /// The User class represents
Here is my custom logger class, which helps me create logs file in my
Well the problem here is that if you have one DataTemplate for a type
i have a frustrating problem with registering global hook. I am using this class
I have a class user which looks like this: public class User { public
I have quite the problem here. I have an MVP application where I have
I have made a class which a form can inherit from and it handles
Answer Summary: Solved this problem using Jon Skeet's answer below. Here is the finished
I have a Base Class, called primitive Graphics. derived from this class are several

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.