BestWishesfor a happyXmas and a 2016full of ideas and projects! TeamSynaptica
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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 := LocServ.GetCurrentLangID; {$ENDIF} {$IFDEF MSWINDOWS} var buffer: MarshaledString; UserLCID: LCID; BufLen: Integer; begin // defaults UserLCID := GetUserDefaultLCID; BufLen := GetLocaleInfo(UserLCID, LOCALE_SISO639LANGNAME, nil, 0); buffer := StrAlloc(BufLen); if GetLocaleInfo(UserLCID, LOCALE_SISO639LANGNAME, buffer, BufLen) <> 0 then Result := buffer else Result := 'en'; StrDispose(buffer); {$ENDIF} end; { code } //See more at: http://codeverge.com/embarcadero.delphi.firemonkey/detect-current-language-on-andr/2001235#sthash.zjLIi2KY.dpuf |
Hi developers! We’ve just released a new tool called Remode. Remode allows you to have a full remote control of your PC and/or Mac. When Remode Manager is up and running on your PC or Mac, you can use a simple browser or our Android App (Ios work in progress) to give commands. Android App…
Read more
To send in background your Delphi application on Android you can simply call the moveTasktoBackGround method of the mainActivity class defined in the FMX.Platform.Android library. To do this task during the application startup phase on the main form we suggest to use a timer object so that the main form can completely render before going…
Read more
grande affidabilità del’infrastruttura synatica 🙂
1 2 3 4 |
{$IFDEF ANDROID},Androidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android, IdURI, Androidapi.JNI.JavaTypes, Androidapi.Jni.Net, Androidapi.JNIBridge {$ENDIF}; |
The Java TimeInMills is similar to UnixTime but is in Millisenconds, so to convert it :
1 |
JavaTimeinMills := DateUtils.DateTimeToUnix(now) * 1000; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
procedure TfrmTimeDetail.btnShareClick(Sender: TObject); {$IFDEF ANDROID} var Intent: JIntent; CalendarIni: JCalendar; Uri : string; begin Uri := 'content://com.android.calendar/events'; Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_EDIT, TJnet_Uri.JavaClass.parse(StringToJString(TIdURI.URLEncode(uri)))); //Intent.setType(StringToJString('vnd.android.cursor.item/event')); intent.putExtra(StringToJString('beginTime'), DateTimeToUnix( (clDay.Date + teTimeDal.Time)) * 1000 ); intent.putExtra(StringToJString('allDay'), false); intent.putExtra(StringToJString('rrule'), StringToJString('FREQ=YEARLY')); intent.putExtra(StringToJString('endTime'), DateTimeToUnix( (clDay.Date + teTimeAl.Time)) * 1000 ); intent.putExtra(StringToJString('title'), StringToJString(edCommessa.Text)); intent.putExtra(StringToJString('description'), StringToJString(Memo1.Text)); SharedActivity.startActivity(Intent); end; |