2017-08-29 47 views
0

如何在DialogAdapter(mContext,nListId,(ArrayList<String>)imagelist)裏面調用materialDialog.dismiss(),讓對話框通過適配器解除? 我曾嘗試將materialDialog作爲參數傳遞給Dialogadapter,但在OnBindViewHolder()中調用materialDialog.dismiss()會給出空指針異常。 這是鏈接到材料對話框庫:https://github.com/afollestad/material-dialogs如何從正在調用的適配器中關閉材質對話框(afollestad)?

materialDialog = new MaterialDialog.Builder(mContext) 
            .title("Choose Node") 
            .adapter(new DialogAdapter(mContext,nListId,(ArrayList<String>)imagelist,materialDialog), null) 
            .positiveText("YES") 
            .negativeText("CANCEL") 
            .build(); 
            .show(); 

回答

0

您可以使用監聽器用於這一目的

+0

這並不提供答案的問題。一旦你有足夠的[聲譽](https://stackoverflow.com/help/whats-reputation),你將可以[對任何帖子發表評論](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提問者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- I-DO-代替)。 - [來自評論](/ review/low-quality-posts/17174077) –

相關問題