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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:27:13+00:00 2026-06-09T03:27:13+00:00

I have a method that displays and AlertDialog that has 3 Buttons ; neutral,

  • 0

I have a method that displays and AlertDialog that has 3 Buttons; neutral, negative and positive.

I want the neutral to open the contacts application in front of my application with a Dialog. However, the Dialog is shut when i come back to my Activity even though it is supposed to be “neutral” and i did not put any return statement.

Here is my code:

    public static void showAddFriendDialog(Context ctx1) {
        final Context ctx = ctx1;

        //showGetFriendsFromContacts(ctx);

         // Set an EditText view to get user input 

         final EditText input = new EditText(ctx); input.setHint("name");
         final EditText input2 = new EditText(ctx); input2.setHint("firstname");
         final EditText input3 = new EditText(ctx); input3.setHint("login/email");

         // on est obligé de mettre un layout car on peut que mettre un setview
         LinearLayout layout = new LinearLayout(ctx);
         layout.setOrientation(LinearLayout.VERTICAL);

         layout.addView(input);
         layout.addView(input2);
         layout.addView(input3);

         AlertDialog.Builder builder = new AlertDialog.Builder(ctx);

         builder.setCancelable(true);
         builder.setTitle("Add a friend");
         builder.setMessage("Fill in the fields you know or get your contact info from your Contact List :");

         builder.setView(layout);

        builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {

........................

            }
        });
        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                return;
            }
        });

        builder.setNeutralButton("Contact List",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {

                        ctx.startActivity(new Intent(null, ContactsContract.Contacts.CONTENT_URI));

                    }

       });


        builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                return;
            }
        });

        builder.show();
    }

Does someone know what is causing that ?

  • 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-09T03:27:14+00:00Added an answer on June 9, 2026 at 3:27 am

    Default dialogs will always quit when a button is clicked no matter what.

    It is recommended for you to implement your custom dialog to avoid that.

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

Sidebar

Related Questions

I have a method that posts HTTP data and displays a UIAlertView if there
I have an IBAction instance method that is connected to a slider, and displays
I have an Android application that displays a list of names using checkboxes. I
If you have an update panel, that displays a number in its Load method,
I have an existing application that displays Google Analytics data. Currently, it stores the
I Have a common method that displays alert message using page.clientScript. But later on
Does Facebook have an API method that displays the total number of users registered
I have a Form in my application that displays some data. When I first
I have method that returns Drawable , and if its Bitmap object is recycled
I have method that returned NSManagedObject and I don't know what kind of NSManagedObject

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.