Friday, 3 July 2015

android, java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.



    java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:122)
            at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
            at android.support.v7.app.AppCompatDialog.<init>(AppCompatDialog.java:48)
            at android.support.v7.app.AlertDialog.<init>(AlertDialog.java:92)
            at android.support.v7.app.AlertDialog$Builder.create(AlertDialog.java:882)





the reason is I did this in my code:

AlertDialog.Builder builder = new AlertDialog.Builder(MyApplication.getAppContext());

AppContext give this error.



Below link doesn't really help, but still good to have a look:

http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity








No comments:

Post a comment