I have a dialog where I use setSingleChoiceItems
. When choosing the item "years" my dialog needs to make CheckBox visible. How can I do this?
This is my code:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // TODO 1) Удалить test_dialog.xml
builder.setTitle(R.string.statistic_dialog_title)
.setSingleChoiceItems(R.array.statistic_chart_filter, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == 0){
Toast.makeText(getContext(), R.string.chart_filter_item_year, Toast.LENGTH_SHORT).show();
} if (i == 1){
Toast.makeText(getContext(), R.string.chart_filter_item_month, Toast.LENGTH_SHORT).show();
}
}
})
.setView(inflater.inflate(R.layout.test_dialog, null))
.setPositiveButton(R.string.statistic_dialog_positive_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.setNegativeButton(R.string.statistic_dialog_negative_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.show();
Thank you.