The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,319 other followers

Archive for December 29th, 2020

Why does my Android application, compiled with development tool XXX version YYY, no longer work?

Posted by jpluimers on 2020/12/29

Still relevant, not limited to Delphi, though other environments often have a better warning system in place: [WayBack] Why does my Android application, compiled with Delphi Rio, no longer work?.

TL;DR: over time, Android and the development tools for it, require you to support more recent Android SDK levels.

Those SDK levels come with different requirements than past ones, so when recompiling, you need to check if you fulfill these requirements.

When you don’t, the application is likely to crash, sometimes without any indication why.

Via: [WayBack] Dalija Prasnikar – Google+ /

[WayBack] Dalija Prasnikar on Twitter: “Why does my Android application, compiled with Delphi Rio, no longer work?”

–jeroen

Posted in Android, Delphi, Development, Mobile Development, Software Development | Leave a Comment »

Small Delphi tricks: initialise out parameters in the caller when they are stored in local variables; a Run for TProc

Posted by jpluimers on 2020/12/29

Two small Delphi tricks:

On out parameters

When you have out parameters, and the caller passes local variables for them, remember that:

  1. the compiler then will not issue an “unitialised variable” warning any more because it expects the callee to fill that parameter
  2. if the local variable is non-managed, it will have a random value depending on the call stack state

A RunProc method that executes a TProc

Every so often you want to refactor a method to use two or more different algorithm implementations.

A good start is to have some conditional, to choose the algorithm, then have anonymous methods implement each algorithm.

This quickly gives you a feel of where the local vars of the original method need to go:

  • local to an implementation
  • local to the original method
  • parameters to the algorithm

A parameterless runner can be a good start to call these methods:

uses
   System.SysUtils;
/...
procedure RunProc(const AProc: TProc);
begin
  AProc();
end;

You can extend this to TProc<T> and further generic forms, by adding parameters. In that case however, the need to be inside a record (because global methods cannot be generic).

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

 
<span>%d</span> bloggers like this: