android - How can I programmatically make sure a user has selected an option with AlertDialog.Builder? -
in android application, have created dialog box showing user multiple options list.
i have used class so: http://developer.android.com/reference/android/app/alertdialog.builder.html
more specifically, used setmultichoiceitems
now options displaying correctly , works well. however, need make sure user has selected 1 of these options , not pressed proceeding button have set using setpositivebutton.
is there way can programmatically make sure 1 or more of these options picked? set quick if statement , display warning dialog if none of options picked.
thank , apologize if question has been asked before.
the easiest way use dialoginterface.onmultichoiceclicklistener
keep track of user's selections. initialize array before create dialog , every time user makes/clears selection add/remove array. once user hits positive button check if array empty: if is, made no selections.
Comments
Post a Comment