使用v7下的AlertDialog遇到的问题

使用v7下的AlertDialog 关于Theme的问题

1
You need to use a Theme.AppCompat theme (or descendant) with this activity.

开始在网上找到如下的解决方法:
https://blog.csdn.net/u010072933/article/details/52325755

当时我的程序并不想改theme因为我用到了ActionBar toolbar
我担心如果修改的话会对我之前的有影响.

所以我尝试修改了new AlertDialog传入的context

我的这个AlertDialog的创建显示是在 RecyclerCommonAdapter 中,当点击一个item的时候显示AlertDialog
所以这里刚开始也没注意就传入了一个getApplicationContext(),然后运行的时候就报错了

后来改成MyActiovity.this 就可以了.