This should help:
.setMultiChoiceItems(multiChoiceItems, null, new DialogInterface.OnMultiChoiceClickListener() {
});
when you'll start typing new DialogeInterface.OnMul...... it will autoimplement the abstract method:
onClick(DialogInterface dialog, int which, boolean isChecked)
I think you can use null instead of your checkedItems array, depending if you need to use the data from this array or not.
What you need to do:
Create a new array for the sequence, and in the onClick Listener, just add the code inside to add the selected element in the sequenceArray! At the end, this array will contain the data in the order it was selected.
String[] multiChoiceItems = getResources().getStringArray(R.array.dialog_choice_array_monday);
ArrayList<String> sequenceArray = new ArrayList<>();
new AlertDialog.Builder(NewScheduleActivity.this)
.setTitle(getString(R.string.main_dialog_multi_choice_monday))
.setMultiChoiceItems(multiChoiceItems, null, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
sequenceArray.add(multiChoiceItems[which])
}
}
.setPositiveButton(getString(R.string.dialog_ok), null)
.setNegativeButton(getString(R.string.dialog_cancel), null)
.show();
}
Android website: https://developer.android.com/reference/android/content/DialogInterface.html