This is a picture of an AlertDialog that is shown within my app. It should have a deny and an accept button.
As you can see it has not:
I cannot reproduce this error as I dont have a phone with Android 7.1. The picture was taken on a Google Pixel and send to me.
All other Android versions this App was tested upon did not encounter this bug. (Versions 4.1, 6.0.1)
Here is code of the method creating the dialog:
/**
* Creates a 2 options dialog.
* @param context
* @param title headline of the dialog
* @param message main text of the dialog
* @param accept listener for the accept button
* @param deny listener for deny button
* @param acceptText text of the positive answer button
* @param denyText text of the negative answer button
* @param cancelable weather a click to anywhere but the presented buttons dismisses the dialog
* @return a created dialog instance. To display it call show()
*/
public static AlertDialog createAcceptDenyDialog(Context context,
String title, String message, String acceptText,
String denyText, boolean cancelable,
DialogInterface.OnClickListener accept,
DialogInterface.OnClickListener deny,
DialogInterface.OnDismissListener dismiss){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
.setTitle(title)
.setMessage(message)
.setPositiveButton(acceptText, accept)
.setNegativeButton(denyText, deny)
.setCancelable(cancelable)
.setOnDismissListener(dismiss);
return alertDialog.create();
}
This is the code causing the dialog to be displayed:
public void showRequestErrorRetryDialog(String title, String message) {
Dialog dialog = DialogFactory.createAcceptDenyDialog(this
, title
, message
, getString(R.string.retry_button)
, getString(R.string.abort_button)
, true
, (dialogInterface, i) -> {
onStartServerCommunication();
showProgressOverlay();
}
, null
, null);
dialog.show();
}
As you can see, I use retrolambda.
Does anyone have an idea what happens?
The solution which is working for me was to add the following lines on my style.xml :
It's working perfectly, I hope it will help you guys.