Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Save Selections DialogInterface.OnMultiChoiceClickListener
- new AlertDialog.Builder(this)
- .setTitle("Weekdays")
- .setMultiChoiceItems(weekdayOptions, selections, new DialogInterface.OnMultiChoiceClickListener()
- {
- public void onClick(DialogInterface dialog, int whichButton, boolean isChecked)
- {
- if( selections[whichButton] == true)
- {
- //Only need the selected(True) values
- Log.d(TAG, "Choice: " + whichButton);
- }
- Log.d(TAG, "Weekdays Selected: " + whichButton + selections[whichButton]);
- selections[whichButton] = isChecked;
- }
- })
- .setPositiveButton("OK", new DialogButtonClickHandler())
- .create()
- .show();
- }
- public class DialogButtonClickHandler implements DialogInterface.OnClickListener
- {
- public void onClick( DialogInterface dialog, int clicked )
- {
- switch(clicked)
- {
- case DialogInterface.BUTTON_POSITIVE:
- //I want to check here what the user selected
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment