android - open alertDialog in kotlin, how to set both message with radio buttons -
trying open alertdialog in kotlin, dialog needs show title , text message , radio button list.
made dialog part work, cannot set message (body), if set message radio button not shown(???).
i guess might limitation of alertdialog, or knows work around?
fun openalertdialog(title: string, alertmessage: string, items: arraylist<string>) { val poistion = 0 val alertdilogbuilder = alertdialog.builder(activity, r.style.mydialogetheme) alertdilogbuilder.settitle(title) //alertdilogbuilder.setmessage(alertmessage) //<== if setmessage radio button not show .setsinglechoiceitems(list, poistion, object : dialoginterface.onclicklistener { override fun onclick(dialog: dialoginterface, index: int) { onselectedcategory(items[index]) toast.maketext(activity.applicationcontext, items[index], toast.length_short).show() dialog.dismiss() } }) alertdialog = alertdilogbuilder.create() alertdialog.setbutton(alertdialog.button_positive, “ok", { dialoginterface, -> onselectedcategory(items[0]) }) alertdialog.setbutton(alertdialog.button_neutral, "cancel", { dialoginterface, k -> dialoginterface.dismiss() }) alertdialog!!.show() }
wiki
Comments
Post a Comment