Open MyActivity.java and add a variable for storing the initial states:
final boolean[] states = {false, false, true};
Replace the setItems or setSingleChoiceItems with:
builder.setMultiChoiceItems(items, states, new DialogInterface.OnMultiChoiceClickListener(){
public void onClick(DialogInterface dialogInterface, int item, boolean state) {
Toast.makeText(getApplicationContext(), items[item] + " set to " + state, Toast.LENGTH_SHORT).show();
}
});
Redeploy (mvn clean install) and you should be able to (un)select different ones.
No comments:
Post a Comment