AlertDialog
항목을 표시 할 때 문제가 있습니다. 코드를 확인 했으니 까. items
만 표시되지 않습니다. 나는 빈 항목이 대화 상자를 얻을AlertDialog MultipleChoice가 항목을 표시하지 않습니다.
//PREFERENCE CATEGORY - DIALOG
public void alertDialogPrefCat(){
//TODO -
String[] categories = new String[]{"Health","Universities","Scholars","Professionals",
"Business","Engineering","Architecture","Foundations",
"Charities", "Culture", "Technology","Blog", "Music",
"Sports","Insurance"};
//GET CHECKED
final boolean[] selectedCategory = new boolean[]{false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
AlertDialog.Builder alertDialogCategoryPicker = new AlertDialog.Builder(this);
final List<String> itemGet = Arrays.asList(categories);
alertDialogCategoryPicker.setTitle("Interest: ")
.setMessage("Select category of org you want.")
.setCancelable(false)
.setMultiChoiceItems(categories, selectedCategory,
new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
selectedCategory[which] = isChecked;
String currentItem = itemGet.get(which);
Toast.makeText(MainActivity.this, currentItem, Toast.LENGTH_SHORT).show();
}
})
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialogCategory = alertDialogCategoryPicker.create();
dialogCategory.show();
}
:
여기 내 코드입니다.
당신이 취급이 용이 사용자 정의 대화 상자를 만들 수 있습니다. –