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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:21:06+00:00 2026-06-02T01:21:06+00:00

I have a class which extends MapActivity. I have pins which I place on

  • 0

I have a class which extends MapActivity.

I have pins which I place on the map using a function called updateMap.The pins are placed in locations based on a list of bus stops that are loaded in.

I would like to show a loading dialog while the array of stops is downloaded but I get errors with my code. I currently have the dialog popping up and a thread spawning to load the bus routes and update the map.

After some research I’ve come to realize that the UI layer can’t be updated from a separate thread. I’ve tried moving things around but nothing seems to work.

Any help appreciated!

private void updateMap(final int selectedRoute, final boolean isMajor, final boolean isMinor)
{
    dlg = ProgressDialog.show(TransitMap.this, "Updating Map", "Processing... Please wait...");
    new Thread()
    {
        public void run()
        {
            try 
            {
                TransitMap.this.removePins();
                TransitMap.this.addRoutePins(selectedRoute, isMajor, isMinor);
                TransitMap.this.addBusPins(selectedRoute);

                map.post(new Runnable()
                {   
                    public void run()
                    {
                        TransitMap.this.map.postInvalidate();
                    }
                });
            }
            catch(Exception ex)
            {
        }
            // processing done, hide progress dialog
            dlg.dismiss();
        }
    }.start();
}

After modifying the class to use AsyncTask, I still have my program crashing!

This is the logCat error

04-13 15:16:49.217: E/AndroidRuntime(21898): FATAL EXCEPTION: main
04-13 15:16:49.217: E/AndroidRuntime(21898): java.util.ConcurrentModificationException
04-13 15:16:49.217: E/AndroidRuntime(21898):    at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:576)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:44)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at com.google.android.maps.MapView.onDraw(MapView.java:530)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.View.draw(View.java:6971)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1710)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1708)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.View.draw(View.java:6974)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1710)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1708)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1708)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1708)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1708)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.View.draw(View.java:6974)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.drawChild(ViewGroup.java:1710)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.View.draw(View.java:6974)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1929)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewRoot.draw(ViewRoot.java:1590)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewRoot.performTraversals(ViewRoot.java:1290)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.view.ViewRoot.handleMessage(ViewRoot.java:1939)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.os.Looper.loop(Looper.java:143)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at android.app.ActivityThread.main(ActivityThread.java:4196)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at java.lang.reflect.Method.invokeNative(Native Method)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at java.lang.reflect.Method.invoke(Method.java:507)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-13 15:16:49.217: E/AndroidRuntime(21898):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
04-13 15:16:49.217: E/AndroidRuntime(21898):    at dalvik.system.NativeStart.main(Native Method)
  • 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-02T01:21:07+00:00Added an answer on June 2, 2026 at 1:21 am

    run() non UI-Thread so you cant dismiss it in run Use AsyncTask or Handler

    in AsyncTask ….

    onpreExecute()= ProgressDialog dialog = new ProgressDialog(this);dialog.show(); 
    inBackground(...)=put your run code here ..... 
    onpostExecute =dialog.dismiss();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mapview class which extends MapActivity. The code i'm using follows the
I have class A which extends the Activity class. This class is in package
Hi Experts: I have a class which extends JPanel now ShapePanel (Sp) this gets
I am trying to create downloading progress. I have my class which extends AsyncTask:
I have crated a class which extends the ListFragment . I have one button
I have a custom class loader which extends from a URLClassLoader. I added a
In Java I have created the following class which extends ImageView to create a
I have a view in Eclipse (implemented by a class which extends org.eclipse.ui.part.ViewPart )
I have 2 web user controls, both inherit the same base class which extends
I have two Java classes: B, which extends another class A, as follows :

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.