Search code examples
delphifiremonkey

How to show and hide a virtual keyboard (android)


With Delphi (berlin) what is the good method to show and hide a virtual keyboard under Android ?

i put on my form a native android edit. i set setShowSoftInputOnFocus(false); and i try to open manually the keyboard like

  var aVirtualKeyboardService: IFMXVirtualKeyboardService;
  TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(aVirtualKeyboardService));
  if (aVirtualKeyboardService <> nil) then aVirtualKeyboardService.ShowVirtualKeyboard(self);

but it's not work :( sometime the keyboard is show, sometime not :(


Solution

  • Take a look at IFMXVirtualKeyboardService. It has ShowVirtualKeyboard and HideVirtualKeyboard methods.