Why does Android AlertDialog set setSingleChoiceItems to not display the list? [setMessage and setSingleChoiceItems cannot be used at the same time], setsinglechoiceitems
Today I wrote a simple function, such as a question. The result list is not displayed.
The code is rewritten once, and it is found that setMessage and setSingleChoiceItems cannot be used at the same time.
Correct:
Private void mobilePhone () {AlertDialog. builder builder = new AlertDialog. builder (HomePageChildrenActivity. this. getParent (); if (children_Data.schoolbean.schType.equals ("K") {// kindergarten List <FriendsBean> teacherlist = new ArrayList <FriendsBean> (); for (int I = 0; I <children_Data.friends.size (); I ++) {if (children_Data.friends.get (I ). getUsertype (). equals ("T") {teacherlist. add (children_Data.friends.get (I ));}} String [] teachers = new String [teacherlist. size ()]; for (int I = 0; I <teacherlist. size (); I ++) {teachers [I] = teacherlist. get (I ). getUserneme ();} ButtonOnClick buttonOnClick = new ButtonOnClick (0, teacherlist); builder. setTitle ("select a instructor"); builder. setSingleChoiceItems (teachers, 0, buttonOnClick); builder. setPositiveButton ("OK", buttonOnClick); builder. setNegativeButton ("cancel", buttonOnClick);} else {builder. s EtMessage ("are you sure you want to call" + app. CurrentChildren. childrenName +? "); Builder. setTitle ("prompt"); builder. setPositiveButton ("OK", new DialogInterface. onClickListener () {@ Override public void onClick (DialogInterface dialog, int which) {Intent intent = new Intent (); intent = new Intent (Intent. ACTION_CALL, Uri. parse ("tel:" + children_Data.TeaherBean.getMobilePhone (); startActivity (intent); dialog lephone. dismiss () ;}}); builder. setNegativeButton ("cancel", new DialogInterface. onClickListener () {@ Override public void onClick (DialogInterface dialog, int which) {dialog. dismiss () ;}}) ;}builder. show ();}