A beginner here..
I'm unable to create alert dialog. It occurs when I use `alertDialog.show();
this error--
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
my code,
logoImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder=new AlertDialog.Builder(getApplicationContext());
builder.setTitle("hello");
builder.setMessage("hello how are you");
AlertDialog alertDialog= builder.create();
alertDialog.show(); //line
}
});
my logcat..
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:555)
at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:94)
at android.support.v7.app.AlertController.installContent(AlertController.java:232)
at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:279)
at android.app.Dialog.dispatchOnCreate(Dialog.java:394)
at android.app.Dialog.show(Dialog.java:283)
at com.abmm.include_activity$15.onClick(include_activity.java:459)
thank you buddies..