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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:14:34+00:00 2026-06-08T10:14:34+00:00

i have a mapview that shows some pois with a ItemizedOverlay. When i tap

  • 0

i have a mapview that shows some pois with a ItemizedOverlay. When i tap on a POI, some work starts, and it takes some seconds. In the onTap method i call the handler to show the dialog, and to hide it.

I debug the code and i check that the case Util.SHOW_DIALOG: of the switch of the handler is being called correctly, but the dialog isn’t being shown to the user…..

What’s wrong in my code?

This is part of my MyMapActivity class, as you can see my mapview haves a handler:

public Handler dialogHandler;
private ProgressDialog progressDialog;

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);             
.
.
.
/* handler para mostrar y ocultar el reloj de carga */ 
        dialogHandler = new Handler(){
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);               
                switch( msg.what ){
                    case Util.SHOW_DIALOG:
                        progressDialog = ProgressDialog.show(MyMapActivity.this, "" , "Cargando...", false );
                        break;
                    case Util.HIDE_DIALOG:
                        if( progressDialog != null )
                            progressDialog.dismiss();
                        progressDialog = null;
                        break;              
                }
            }
        };

And this is part of the ItemizedOverlay class, the onTap method of the ItemizedOverlay calls the handler with this code:

protected boolean onTap(int index) {
            try{
                OverlayItem item = (OverlayItem)this.mOverlays.get(index);      
                    map.dialogHandler.sendEmptyMessage(Util.SHOW_DIALOG);
.
.
//doing some work
.
.
map.dialogHandler.sendEmptyMessage(Util.HIDE_DIALOG);
  • 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-08T10:14:36+00:00Added an answer on June 8, 2026 at 10:14 am

    ummm…

    does the “//doing some work” involve working on the same thread as the one used on the onTap ?
    if so, that’s the ui thread , so you’ve sent the ui thread 2 messages – one to show and one to hide , before it could even handle them , and when it finally reaches the point it can handle them, it handles both of them , so for a very short time (probably un-noticed) the progressDialog will be shown.

    anyway, use another thread for the background work , or use asyncTask .

    if you use asyncTask , you can show the dialog before the work starts , and hide it when it’s finished/canceled .

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

Sidebar

Related Questions

I have an app that has a mapview, and it shows 20 pins (from
I have a simple mapview that has the following viewdidload method and didupdate to
In my viewDidLoad: method I have set the MapView like this so that if
I have a MapView that will contain alot of overlays. For this i've extended
HI, I have a Mapview with some marker points + a marker for current
I have a FrameLayout view which contains one (MapView-like) control and some additional buttons
I have created a simple map app that shows the local garage sales in
I have an Android Activity that displays Google Maps through MapView control and extending
I have a MKMapView (obviously), that shows housing locations around the user. I have
Hello i have a mapView and i think it takes too much memory after

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.