delphi-xe5

Delphi XE5 Android. How to use PowerManager.WakeLock?

亡梦爱人 提交于 2019-11-28 09:59:11
问题 I'd like to keep device on and avoid unloading my application from memory even while there is no user activity. Something like service. I made module like How to check if network is available on Android and iOS ( Delphi XE5 ) but system crushes when I run SetWakeLock: unit Android.PowerManager; interface function SetWakeLock : boolean; procedure ReleaseWakeLock; implementation uses System.SysUtils, Androidapi.JNI, Androidapi.JNIBridge, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI

Generic Threadsafe Property

那年仲夏 提交于 2019-11-28 07:01:15
I have created this "threadsafe" generic property, that i can use between the main thread and a background Thread. I made it because i was tired of creating Lock-Objects for all my properties and variables. TLockedProp<MyType> = class private FMyProp:MyType; PropLock:TObject; procedure SetMyProp(const Value: MyType); function GetMyProp: MyType; published property Value:MyType read GetMyProp write SetMyProp; public Constructor Create; Destructor Destroy;override; end; { TLockedProp<MyType> } constructor TLockedProp<MyType>.Create; begin inherited; PropLock:=TObject.create end; destructor

How can I get the number of elements of any variable of type set?

血红的双手。 提交于 2019-11-28 03:18:07
问题 AFAIK there's no built-in function for that. Searching the web I found this function and it works for me, but I prefer not to use it since it's assembly and I can't understand what it is doing. So I wrote this function that also works: function Cardinality(const PSet: PByteArray; const SizeOfSet(*in bytes*): Integer): Integer; const Masks: array[0..7] of Byte = (1, 2, 4, 8, 16, 32, 64, 128); var I, J: Integer; begin Result := 0; for I := 0 to SizeOfSet - 1 do for J := 0 to 7 do if (PSet^[I]

Delphi XE5 right to left languages don't appear as they should in android

ε祈祈猫儿з 提交于 2019-11-27 23:32:53
as the title says , a text from a RTL language like persian or arabic doesnt show well in android for example the word "سلام" shows as "م ا ل س". this problem happens even in text inputs (which i thought they were native and native android textboxes support that) is there a way to fix this? As per LURD's suggestions. Download and use D.P.F Delphi Android Native Components and/or D.P.F Delphi iOS Native Components . That will fix the problem in XE7 and prior. According to the documentation with the Delphi XE8 beta the problem is fixed there as well. As a last resort (if you feel up to it),

AlphaBlend in FireMonkey

岁酱吖の 提交于 2019-11-27 21:55:02
问题 How can I change AlphaBlend value (of a form) in a FireMonkey Desktop Application? Well It's available in VCL Application but I couldn't find it in FireMonkey. Screenshot: 回答1: To make your form background semitransparent you should set form Transparency property to true and use Fill.Color with alpha value like $AAFFFFFF (with Fill.Kind = bkSolid ). in this case form border becomes invisible (at least in Delphi XE2 ) if you need to make all components at form semitransparent then place

How to close android app in Delphi-XE5 Firemonkey application?

无人久伴 提交于 2019-11-27 15:34:35
I have this piece of code procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean); var msg: String; begin msg := 'Do you really want to exit?'; if MessageDlg(msg, TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0) = mrNo then CanClose := False else CanClose := True; { FIXME: don't want to work on Android } end; It works perfectly on Windows. Application closes if I choose 'Yes'. However, application does NOT close on Android. What I am doing wrong? Having the application close when the last form is closed is a Windows thing. An Android app will keep running.

Delphi XE5 Android : how to make each listview item have its own template?

为君一笑 提交于 2019-11-27 07:20:02
问题 Is there a way to make the TListView of Delphi to behave like actual ListView in android? for example each item of the list has its own "View" and in that view can be multiple other views(components) like multiple text boxes and check boxes and ...? 回答1: Yes there is a way. I make it by using these two methods. The CreateItem method is where you put the components you want in the listitem. procedure TForm1.CreateItem; var edit1:TClearingEdit; editCalendar1:TCustomCalendarEdit; begin edit1:=

Android Application Version (RAD Studio XE5)

与世无争的帅哥 提交于 2019-11-27 07:05:43
问题 How to get the version of an Android application using the Delphi XE5? I need the "versionName" information. 回答1: You can use the getPackageInfo method of the JPackageManager class to get information about you package, from here access the versionName property to get the versionName . Try this sample uses Androidapi.JNI.JavaTypes, FMX.Helpers.Android, Androidapi.JNI.GraphicsContentViewText; {$R *.fmx} procedure TForm25.Button1Click(Sender: TObject); var PackageManager: JPackageManager;

Generic Threadsafe Property

大憨熊 提交于 2019-11-27 01:40:29
问题 I have created this "threadsafe" generic property, that i can use between the main thread and a background Thread. I made it because i was tired of creating Lock-Objects for all my properties and variables. TLockedProp<MyType> = class private FMyProp:MyType; PropLock:TObject; procedure SetMyProp(const Value: MyType); function GetMyProp: MyType; published property Value:MyType read GetMyProp write SetMyProp; public Constructor Create; Destructor Destroy;override; end; { TLockedProp<MyType> }

How to check if network is available on Android and iOS ( Delphi XE5 )

你。 提交于 2019-11-26 16:55:35
问题 How to check if network is available on Android and iOS? 回答1: Try this: unit Network; interface function IsConnected: Boolean; function IsWiFiConnected: Boolean; function IsMobileConnected: Boolean; implementation uses System.SysUtils, Androidapi.JNIBridge, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.JavaTypes, FMX.Helpers.Android, Androidapi.Helpers, Misc; type JConnectivityManager = interface; JNetworkInfo = interface; JNetworkInfoClass = interface(JObjectClass) ['{E92E86E8-0BDE