views:

69

answers:

0

I want to know the process or order of creating the AlertDialog. The order of I asking this question is that I suppose to filter and disable some list item in the AlertDialog. It this must be dynamically. So I chose overwrite the onPrepareDialog(int id, Dialog dialog) method.

First I create a AlertDialog in the onCreateDialog(int id) method

protected Dialog onCreateDialog(int id) {
    --------

    builder.setMultiChoiceItems(itemsId, checkedItems, mListenter);

    ---------
}


protected void onPrepareDialog(int id, Dialog dialog) {
    -----------
    ListView mListView = ((AlertDialog)dialog).getListView();
    mListView.setItemChecked(0, false);
    mListView.invalidateViews();

    View view = mListView.getChildAt(0);
    -----------
}

But these code not work. The first item was still be checked after I check it before. And the ChildView is null when the first time display the dialog, why? How to filer some item in ListView and how to disable but show some of items.