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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:04:47+00:00 2026-05-28T04:04:47+00:00

In my Android application when an user touch an overlayItem on the map for

  • 0

In my Android application when an user touch an overlayItem on the map for more than 1.5 seconds an AlertDialog appear. I need user’s answer (alertDialogResult) to either keep the overlayItem or remove it from the map. However, after the AlertDialog inner-class get called, the outer-class continue it execution and at that point I do not have user’s answer.

Any suggestions? Any alternative to AlertDialog?

    final Boolean alertDialogResult = false;

        if ( ( pressEndTime - pressStartTime ) > 1500 )  {  

            AlertDialog.Builder alertDialog = new AlertDialog.Builder( mapView.getContext() );
            alertDialog.setTitle( "Warning!" );
            alertDialog.setMessage("Do you want to delete the selected overlayItem?");
            alertDialog.setCancelable(false);
            alertDialog.setIcon(R.drawable.ic_dialog_alert);

                alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.dismiss();
                        alertDialogResult = true;


                    }   
                });

                alertDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.dismiss();
                    }

                });

            alertDialog.show();

            longPress = true;

            if ( alertDialogResult  == true ) {
                AndroidMainActivity.sendDeleteOverlayRequest(mapView, overlayItemId);
            }
  • 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-28T04:04:47+00:00Added an answer on May 28, 2026 at 4:04 am

    Why do you need alertDialogResult flag, you can move

      AndroidMainActivity.sendDeleteOverlayRequest(mapView, overlayItemId); 
    

    to onClick of positiveButton

    Edit: Your AlertDialog will not wait for user Interatction after it has been Initialized. That is why there is callback for Onclick.

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

Sidebar

Related Questions

I am developing an Android application and I need to handle various touch events.
In order for the user to control the volume , my android application has
Can i get informed in my android application when a user adds a new
im trying to make an android application that whenever a user conncects to a
Based on the user requirements, he wants to use our android application via pin
I have android application in which for a logged facebook user to retrieve in
I'm making an Android application where I need to slow down the audio being
I am developing an android application where i need to enter multiple rows in
I am writing an android application where the user can add and remove fields
I have an android application that gets user location every 2 minutes using requestLocationUpdates

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.