Dalla versione XE7 di Delphi sono disponibili i componenti per gestire Bluetooth Classico e LE. Con Firemonkey è abbastanza semplice creare anche un server bluetooth. Provando le mie applicazioni sul Raspberry PI3 dove Federico ha montato Marshmallow mi son accorto che se il BT non è disponibile sul device l’applicazione si schiantava. Per ovviare a…
Leggi tutto
To check with Delphi / Firemonkey if the screen is in Landscape or Portrait mode i use the FMXPlatform library as in the example: uses FMXPlatform; … procedure TForm2.FormResize(Sender: TObject); var ScreenService: IFMXScreenService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) then begin if ScreenService.GetScreenOrientation in [TScreenOrientation.soPortrait, TScreenOrientation.soInvertedPortrait] then ShowMessage(‘Portrait Orientation’) else Begin ShowMessage(‘Landscape Orientation’); End; end; end;
With Delphi , to the Seattle version , when you scale a bitmap image to enlarge using the command “Canvas.DrawBitmap(OiginalBitmap, RectF(0, 0, OiginalBitmap.Width, OiginalBitmap.Height), RectF(0, 0, Width, Height), 1, False);” the interpolation cant be disabled. A way to eliminate the problem is to manually scale the bitmap directly creating an image pixel by pixel .…
Leggi tutto
Here is a sample code (function) to get the current language (locale) in Delphi 10Seattle. This simple procedure return the locale language for Windows, Mac and Android. function GetOSLangID: String; {$IFDEF MACOS} var Languages: NSArray; begin Languages := TNSLocale.OCClass.preferredLanguages; Result := TNSString.Wrap(Languages.objectAtIndex(0)).UTF8String; {$ENDIF} {$IFDEF ANDROID} var LocServ: IFMXLocaleService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXLocaleService, IInterface(LocServ)) then Result :=…
Leggi tutto
A very simple way to search, select and import contact information from your phone (Android Contacts) to your android app is: 1) Send the specific android intent “ACTION_PICK”: private void startContactPicker() { Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI); startActivityForResult(contactPickerIntent, CONTACT_PICKER_REQ_CODE); } This intent will do for us and “for free” the operation of opening the…
Leggi tutto