delphi-xe5

How do I handle a back-button press in a (Delphi) Android app?

有些话、适合烂在心里 提交于 2019-11-30 06:49:16
How can I make my Android app react to the back-button? Is there something as high-level VCL's TApplicationEvents to handle it, or do I need to dive deep into low-level Android-specific stuff here? Right now, most of the demo applications have an on-screen back button to go back to a previous screen. Pressing the psysical button always seems to quit the app, and in some situations it results in an access violation. In the form's OnKey... events, the Key parameter is vkHardwareBack on Android. For example: uses FMX.Platform, FMX.VirtualKeyboard; procedure TForm1.FormKeyUp(Sender: TObject; var

Delphi XE5 PAServer Unauthorized user

那年仲夏 提交于 2019-11-30 06:01:29
问题 I have a Windows 8.1 on a VirtualBox with Delphi XE5. On my Mac OSX 10.9.1, I installed the package PAServer version 4.2.0.05 and executed with no password. I've used previously in the PAServer XE4 version, so I know how it works, but tests with XE5 error occurs. When I create an example app for iOS and deploy, I put the IP of my Mac and do a test connection, so I get the following message: Remote Error: Unauthorized user, all server request are ignored. Ping from Windows to Mac is OK. I have

TRestClient/TRestRequest incorrectly decodes gzip response

依然范特西╮ 提交于 2019-11-30 05:44:22
问题 I tried to read a REST API, which is gzip encoded. To be exact, I tried to read the StackExchange API. I already found the question Automatically Decode GZIP In TRESTResponse?, but that answer doesn't solve my issue for some reason. Test setup In XE5, I added a TRestClient, a TRestRequest and a TRestResponse with the following relevant properties. I set the BaseURL of the client, the resource and parameters of the request, and I set AcceptEncoding of the request to gzip, deflate , which

How to convert strings to array of byte and back

谁说胖子不能爱 提交于 2019-11-29 18:01:55
问题 4I must write strings to a binary MIDI file. The standard requires one to know the length of the string in bytes. As I want to write for mobile as well I cannot use AnsiString, which was a good way to ensure that the string was a one-byte string. That simplified things. I tested the following code: TByte = array of Byte; function TForm3.convertSB (arg: string): TByte; var i: Int32; begin Label1.Text := (SizeOf (Char)); for i := Low (arg) to High (arg) do begin label1.Text := label1.Text + ' '

Delphi XE5 Android. How to use PowerManager.WakeLock?

断了今生、忘了曾经 提交于 2019-11-29 15:40:59
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.JavaTypes, FMX.Helpers.Android; type JPowerManager = interface; JWakeLock = interface; JWakeLockClass =

Firemonkey: Adding a font from resource to memory and using it

▼魔方 西西 提交于 2019-11-29 13:40:27
问题 In VCL , I could load a font from resource and without saving it I could use it from memory. Here is the code I use and it works in VCL : procedure TForm1.Button1Click(Sender: TObject); var ResStream : tResourceStream; FontsCount : DWORD; begin ResStream := tResourceStream.Create(hInstance, 'MyResourceName', RT_RCDATA); winapi.windows.AddFontMemResourceEx(ResStream.Memory, ResStream.Size, nil, @FontsCount); ResStream.Free(); button1.Font.name := 'MySavedFontNameInResource'; end; In Firemonkey

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

醉酒当歌 提交于 2019-11-29 09:58:26
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] and Masks[J]) > 0 then Inc(Result); end; Now, I want to know if I can rely on this function? Or maybe

Best strategy for too many Elements in FireMoneky TListView Item [duplicate]

人走茶凉 提交于 2019-11-29 08:55:10
This question already has an answer here: Create a customized Item Appearance for ListView Delphi XE7 1 answer Believe me I did my homework before reaching out for help. I spent last 3 days searching and reading but I couldn't come to a solution. So any help will be highly appreciated. My task is to have a ListView connected to a Dataset where the ListView Item is of the following structure: Bear in mind that Elements 4, 6, & 8 are of fixed values & Color (i.e. labels) Colors of Elements 1 & 10 depends on values of Elements 5, 7, & 9 Best what I got is references to Delphi Standard Example

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

余生长醉 提交于 2019-11-28 12:58:32
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 ...? 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:= TClearingEdit.Create(Self); edit1.Parent := fItem; edit1.Align := TAlignLayout.alClient; edit1.Text :=

Android Application Version (RAD Studio XE5)

纵然是瞬间 提交于 2019-11-28 12:36:34
How to get the version of an Android application using the Delphi XE5? I need the "versionName" information. 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; PackageInfo : JPackageInfo; begin PackageManager := SharedActivity.getPackageManager; PackageInfo :=