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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:49:28+00:00 2026-06-08T23:49:28+00:00

I have an AlertDialog defined this way: final CharSequence[] items = { Red, Green,

  • 0

I have an AlertDialog defined this way:

final CharSequence[] items = { "Red", "Green", "Blue", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten" };

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a color");

builder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int item) {

        // Set items uncheckable

        Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();

    }
});

builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {

    @Override
    public void onClick(DialogInterface dialog, int which) {
        // TODO Auto-generated method stub

    }
});

AlertDialog alert = builder.create();
alert.show();

FIRST QUESTION

Is it possible to mark some of the items as uncheckable?
Although I’m showing various items I what the user understand that the items exist but some of them are uncheckable.

SECOND QUESTION

If there is a way to accomplish my first question, is it possible to put that uncheckable items grayed out?

Thanks,

favolas

  • 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-08T23:49:30+00:00Added an answer on June 8, 2026 at 11:49 pm

    Maybe something like:

    (AlertDialog)builder.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); 
    

    Here is another way:

    Button button = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
    button.setEnabled(false)
    

    See if that works. Also make sure you this after builder.create(); but before alert.show()

    EDIT: For the list items I think you can use getListView() with that you can access the checkable options, and the use setEnabled(false)

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

Sidebar

Related Questions

I have a very simple dialog defined as: import android.app.AlertDialog; import android.content.Context; import android.view.LayoutInflater;
I have one AlertDialog which is working fine.I have set some background images to
can someone help me with this? I have an AlertDialog box and its working
I have following code for alertdialog: AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this); helpBuilder.setTitle(Options); helpBuilder.setMessage(Choose Your
So i have this activity : public class settings_dock extends Activity { AlertDialog alert;
i have created a alertdialog with two radio buttons in it.when user select an
I have AlertDialog with single choice list. I want to put some 'fake' items
I don't know how to put an image into an AlertDialog. I have this
I'd like to have an AlertDialog builder that only has one button that says
I currently have this: Builder yesandno = new AlertDialog.Builder(this); yesandno.setTitle(QuickResponse); yesandno.setMessage(message); yesandno.setPositiveButton(YES, null); yesandno.setNegativeButton(NO,

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.