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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:40:56+00:00 2026-05-31T01:40:56+00:00

I am trying to make a custom dialog with a set of check boxes,

  • 0

I am trying to make a custom dialog with a set of check boxes, and I want to validate them so that if the user clicks the ok button without selecting any one of them, a message will be displayed to the user asking them to select at least one choice. If they have (selected a t least one choice) a message will displayed saying which check boxes that the user has checked.

I can’t continue the validation, can anybody help me and does anybody have any ideas about what I should do to validate the check boxes in a custom dialog?

Button conditions_btn=(Button)findViewById(R.id.conditions_btn);
conditions_btn.setOnClickListener(new View.OnClickListener() {  
    public void onClick(View v) {
        final Dialog ConditionsDialog =new Dialog(ProfileView.this);
        ConditionsDialog.setContentView(R.layout.diseases);
        ConditionsDialog.setTitle(" select  your health condition   ");

        DCB1=((CheckBox) ConditionsDialog.findViewById(R.id.CB1));
        DCB2=((CheckBox) ConditionsDialog.findViewById(R.id.CB2));
        DCB3=((CheckBox) ConditionsDialog.findViewById(R.id.CB3));
        DCB4=((CheckBox) ConditionsDialog.findViewById(R.id.CB4));

        Diseses_ok_btn= ((Button) ConditionsDialog.findViewById(R.id.ok_button));
        Diseses_ok_btn.setOnClickListener(new View.OnClickListener() {  
            public void onClick(View v) {
                //validate the check boxes  
                if(  DCB1.isChecked()== false&&DCB2.isChecked()==false&&DCB3.isChecked()==false&&DCB4.isChecked()==false ) {
                    showMessage("  please select  your health condition ");
                } else {    
                // what should i do here to get the check boxes that have been checked ??
                }
            }
        });

        Diseses_cancel_btn=((Button)ConditionsDialog..findViewById(R.id.cancel_button));
        Diseses_cancel_btn.setOnClickListener(new View.OnClickListener() {  
            public void onClick(View v) {
                ConditionsDialog.dismiss();
            }
        });

        ConditionsDialog.show();
    }
});
  • 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-31T01:40:58+00:00Added an answer on May 31, 2026 at 1:40 am

    I am probably misunderstanding your question, but here goes…

    I don’t know how to access the names of your diseases, but I would do something similar this in your ‘validation block’:

    String msg = "You have selected:";
    if (DCB1.isChecked()) {
        msg += "\n    DCB1"; //or get the disease name
    }
    if (DCB2.isChecked()) {
        msg += "\n    DCB2"; //or get the disease name
    }
    if (DCB3.isChecked()) {
        msg += "\n    DCB3"; //or get the disease name
    }
    if (DCB4.isChecked()) {
        msg += "\n    DCB4"; //or get the disease name
    }
    showMessage(msg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make custom button below is the code. I want to
I'm trying to make a custom text view that has the font set from
I am trying to make a custom dialog in Android. Everything works perfectly except
Trying to make a custom :confirm message for a rails form that returns data
I'm trying to make a custom dialog to show a view in this dialog.
I am trying to make a custom Calendar view and for that I use
I'm trying to write a custom in-window confirm dialog (based on jQuery UI) that
I'm trying to make a custom FxCop rule that will test for calls to
I'm trying to make a custom user model as described in the django docs.
I'm trying to make custom control (like UIButton) manually which can recognize user's touch.

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.