[Android]You need to use a Theme.AppCompat theme on AlertDialog creation

Reprinted from: http://stackoverflow.com/questions/34523384/you-need-to-use-a-theme-appcompat-theme-on-alertdialog-creation

 

Try to set Theme to your AlertDialog by replacing your line of code :

builderSingle =newAlertDialog.Builder(context);

with :

builderSingle =newAlertDialog.Builder(context,R.style.dialogTheme);

Add code in your style.xml :

<stylename="dialogTheme"parent="@style/Theme.AppCompat"><!-- Any customizations for your app running on devices with Theme.Holo here --></style>

and remember one thing to avoid Unable to add window -- token null is not for an application Exception Instead of getApplicationContext(), just use Activityname.this

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326299233&siteId=291194637