I'm trying to show a DialogFragment with multiple choices:
package ro.todo;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.Toast;
public class DialogSettings extends DialogFragment {
boolean[] checkedItems={false,false,false};
final String[] items={"Low priority", "Medium priority", "High priority"};
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
getCheckedItems();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("App settings").setMessage("Show activities in notification bar:")
.setMultiChoiceItems(items, checkedItems, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
}
});
return builder.create();
}
private void getCheckedItems(){
if(System.showNotificationsLow){
checkedItems[0]=true;
}
if(System.showNotificationsMedium){
checkedItems[1]=true;
}
if(System.showNotificationsHigh){
checkedItems[2]=true;
}
}
}
With this code, my DialogFragment only shows only the title and the message. Any idea why?