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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:40:53+00:00 2026-06-16T06:40:53+00:00

I created an AlertDialog: private CharSequence[] _items = { item1, item2, item3, item4, item5,

  • 0

I created an AlertDialog:

private CharSequence[] _items = { "item1", "item2", "item3", "item4",
"item5", "item6", "item7" };

AlertDialog.Builder daysBuilder = new AlertDialog.Builder(this);
    daysBuilder.setTitle("SomeCaption");

    daysBuilder.setMultiChoiceItems(_items,new Boolean[] { false, true, false, 
false false false, true }, SetListener);
    daysBuilder.setPositiveButton("OK", OKListener);
    daysBuilder.setNegativeButton("Cancel", CancelListener);

    AlertDialog alert = daysBuilder.create();
    alert.show();`

Through the statement “new Boolean[] { false, true, false false false false, true }” the items
in the dialog get checked/unchecked by default.

When I open the dialog, change the selection of the items but then dismiss (by pressing cancel or the back-button of the device) the dialog gets dismissed. So far so good.

But when I reopen the dialog, the items have the checked/unchecked state of the previous changes from the last opening of the dialog.

But when the dialog was dismissed at the first opening, I want to have the items checked/unchecked state like when I created the dialog (new Boolean[] { false, true, false false false false, true }).

So basically I need an opportunity to get notified when the dialog gets dissmissed so I can then reset the state of the items.

I tried it with the setOnDismissListener for the dialog object. Unfortunately this is just available in API 17.

setOnDismissListener worked perfect for me (exactly what I need) in the emulator (API 17) but not on my device (Android 4.1 => API 16)

Is there something similar in API 16?

  • 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-16T06:40:55+00:00Added an answer on June 16, 2026 at 6:40 am

    The problem is you are using setOnDismissListener of AlertDialog.Builder. This was introduced in Api level 17, setOnDismissListener of AlertDialog itself has been since api level 1.

    AlertDialog alert = daysBuilder.create();
    alert.setOndismissListener(yourdismisslistener);
    alert.show();`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an alertdialog outside of my application. AlertDialog.Builder builder = new
I have created an AlertDialog with OK button. But it is only displaying the
I created a single choice AlertDialog with Apply and Cancel buttons. When the user
Created Private Key & Self signed certficate in a Key Store keytool -genkey -alias
I have created an DialogFragment which is building and returning AlertDialog from onCreateDialog method.
Following on from another question I have asked I have created a new class
I want to create an AlertDialog like this : I know that a blue
Created .NET WCF service, tested it - works. Generated schemas from Data and service
Created an OpenGraph action and object. Trying to submit my action. When I click
I created a python server on port 8000 using python -m SimpleHTTPServer . When

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.