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