Over the holidays, Hebron posted a question using the Embarcadero Community 3.0 Answers section. He asked "Why all the dialogs are using the "old" Android 2.x style? And how to force my Android app to use the 4.4.x style in all the dialogs like date picker and MessageDlg? Using StyleBook and modying the AndroidManifest.xml doesn’t work. I am currently using XE7. Thanks in advance." I did some testing at my home office and confirmed that there was an issue. I sent an email to our FireMonkey R&D team members and they confirmed the issue and provided the answer.
The fix is very simple : In the FMX.Helpers.Android.pas unit, you need to modify the GetNativeTheme function. Here is the modified code:
function GetNativeTheme: Integer; var LStyleDescriptor: TStyleDescription; begin Result := 0; if not IsGingerbreadDevice and (Screen <> nil) and (Screen.ActiveForm <> nil) and (Screen.ActiveForm.StyleBook <> nil) then begin LStyleDescriptor := TStyleManager.FindStyleDescriptor(Screen.ActiveForm.StyleBook.Style); // the original code -->GetThemeFromDescriptor(LStyleDescriptor); // the next line has the modified code to set the result Result := GetThemeFromDescriptor(LStyleDescriptor); end; end;
You will find the original source code unit in the "C:\Program Files (x86)\Embarcadero\Studio\15.0\source\fmx" folder. Copy the "FMX.Helpers.Android.pas" source file to your project and modify the line to set the return Result.
Add the source file to your project in the IDE.
Build your app and see the modern dialog boxes on your Android KitKat devices.
Thanks for pointing out the issue, Hebron, and for using the new Community 3.0 Answers section.