i am creating material dialog inside the onReceive method.
@Override
public void onReceive(Context context, Intent intent)
{
new MaterialDialog.Builder(context)
.title(sender).content(m).positiveText("C").negativeText("Cl").onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
copyToClipboard(m);
}
}).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
}
}).show();
}
I am getting the below exception
Caused by: com.afollestad.materialdialogs.MaterialDialog$DialogException: Bad window token, you cannot show a dialog before an Activity is created or after it's hidden.