I am trying to do a very basic alertdialog to show some options to select - am trying it as shown but the text for the options is white on a white background. Is there a simple way to change it without making a bunch of xml files? Maybe make a single style?
CharSequence[] array = {"Red", "Blue", "Yellow"};
new AlertDialog.Builder( new ContextThemeWrapper( getActivity(), R.style.Theme_AppCompat_DayNight_Dialog_Alert))
.setSingleChoiceItems(array, 0, null)
.setTitle(R.string.selectweightclass)
.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
int selectedPosition = ((AlertDialog)dialog).getListView().getCheckedItemPosition();
Log.d(TAG, "selectedPosition= "+selectedPosition);
// Do something useful withe the position of the selected radio button
}
})
.show();
PS: Turns out R.style.Theme_AppCompat_Dialog_Alert is good enough for now. Those DayNight themes were messing me up.