3

i'm trying to get an arraylist on alert dialog but i can see the list items only if i click them. any idea whats wrong with the below code .any suggestions pls....

ArrayList<String> matches = data.getStringArrayListExtra(
                    RecognizerIntent.EXTRA_RESULTS); 

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

 final ArrayAdapter<String> aa1=new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_single_choice, matches);
       builder.setSingleChoiceItems(aa1, 0, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {

                numbers.add(aa1.getItem(item));
                aa.notifyDataSetChanged();
                dialog.dismiss();
            }

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

3 Answers 3

1

I believe this is caused by a bug when using the default themes and AlertDialog.Builder.

You should be able to work around it by copying the android.R.layout.simple_list_item_single_choice layout xml out of the platform and creating a local layout file with the android:textColor properties overridden to something other than themed text color attributes.

Sign up to request clarification or add additional context in comments.

Comments

1

Just use this one

android.R.layout.simple_spinner_dropdown_item

1 Comment

i particularly want to use this..."android.R.layout.simple_list_item_single_choice"
0

simple dialog here try this. Just you have to pass string or charsequence array to it shows simple dialog..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.