2017-08-29 50 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) –

相关问题