Paul Toth, a well known Delphi Developer rewrote his CubeMan3D with FireMonkey, making it a cross platform application. The application shows an animated man made of 3D cubes. The man walk in place and turn on himself.
Actually, each cube is a standard FireMonkey TRoundCude 3D component. They are all linked together to form the body and members. The animation is made with a TFloatAnimation for each cube.
It is amazing how short the code is. The code is just the implementation for the AnimationFinish event for the leg. The event handler simply reverse the direction and restart.
The code source is available from here.
Paul Toth is a freelance Certified Delphi Developer. If you need some help with Delphi, feels free to contact him.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
Showing posts with label Mobile. Show all posts
Showing posts with label Mobile. Show all posts
January 23, 2014
January 21, 2014
New blog about Delphi FireMonkey
There is a new blog talking mostly about Delphi FireMonkey on the mobile platform (iOS and Android). The blog also covers other topics, mostly related to FireMonkey and the various supported platforms.
This new blog is named FMXexpress.
Actually, this blog is collecting blog articles from everywhere, display a short abstract and redirect to the original blog article. This is a place to visit on a regular basis. Click here to visit the blog. There is also a corresponding FaceBook page.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
This new blog is named FMXexpress.
Actually, this blog is collecting blog articles from everywhere, display a short abstract and redirect to the original blog article. This is a place to visit on a regular basis. Click here to visit the blog. There is also a corresponding FaceBook page.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
Labels:
Android,
delphi,
FireMonkey,
IOS,
Mobile,
Mobile Development
January 11, 2014
TIniFile for Windows and Android (Source code)
I made available a zip file with the full source code for my TIniFile class compatible with both Windows and Android. You need Delphi XE5 to compile it for Android and a reasonably recent Delphi to compile it for Windows.
You can read the article on my blog. This article explain how it works.
You can download the source code here.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
You can read the article on my blog. This article explain how it works.
You can download the source code here.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
January 5, 2014
TIniFile for Android and Windows
When writing cross platform applications, you are faced with different ways of doing thing depending on the platform. Thanks to the OOP paradigm, we may encapsulate those things in a class and create an implementation specific to each platform. This class hides all the details which are not readily portable.
In this article, I will model a class depending on the operation of the well-known Windows INI files. Of course, Windows own system will be used in the Windows implementation. On Android side, I will use the SharedPreferences API which is very close.
In an INI file, you have Key-Value pairs organized by sections. You can read or write values.
Under Windows, the INI file format is a simple text file with a Key=Value per line. All Key-Value pairs related to the same section are grouped under a header line in the form of the section name between brackets.
Under Android, the file format is not specified. You are not supposed to access the file directly. You use a “Shared Preference Editor” to access it. Android API lacks the “section” concept we have in Windows. This is not a problem. To create the section concept, I will simply prefix each key by his section name surrounded by brackets like this: ‘[‘ + Section + ‘]_’ + Key
Since the beginning, Delphi has a class encapsulation Windows INI files. It is well named “TIniFile” and sits into “System.IniFiles” unit.
I will use the same class name in my implementation and even the save class signature by inheriting from the existing TCustomIniFile for Android and TIniFile for Windows.
Using the same class name as an existing one will force you to pay some attention to the units used in the uses clause, and/or prefix the class name you intent to use with the unit name.
I made things simples. Under both Windows and Android, in your application, you do not use System.IniFiles but FMX.Overbyte.IniFiles. No other change is required. Your application will compile targeted for Windows as well as Android. The conditional compilation is located in FMX.Overbyte.IniFiles and you can safely ignore it!
TIniFile constructor takes a filename as argument. This will be the file where the sections and key-value pairs will be stored. The Windows API store the file exactly where you specify it when using a full path. When you omit the path, Windows tore the file in the Windows directory. Since Windows Vista, normal user cannot write to the Windows directory. So it fails.
I slightly changed the base class so that when a full path is omitted, the INI file is stored in the user profile LoaclAppData special directory (non-roaming version). This is a convenient place most of the time. You may always specify a full path name if you want to store it elsewhere.
Android has a “well known” place to store the preference files. We are not supposed to know where. The actual files are not available directly unless your Android device is rooted.
TIniFile constructor in the Android implementation will simple ignore any path you specify and let Android API store the file where it want it to be stored. This could cause a problem if you want to use the same file name for different files stored in different folders. This will cause trouble since the path is ignored.
The windows implementation is quite trivial since it already exists in Delphi RTL. As stated above, I derived my class from Delphi existing class and only override the constructor to adjust the path when left empty.
The resulting declaration is trivial:
The implementation is simple:
This implementation makes use of SHgetFolderPath API function to get the special directory “LocalAppData” located in each user profile. I used ForceDirectories to create the directory if it does not already exist.
You may want to change the location by changing the constant CSIDL_LOCAL_APPDATA to another one (There is a bunch of such constant, see the API documentation or Delphi source code if you have an edition which includes it).
You may also want to change the string constant “CompanyFolder” to your actual company name instead of OverByte which is my company name.
Using the demo application named “IniFileDemo”, running under Win7, the INI files without path will be stored in “C:\Users\\AppData\Local\OverByte\IniFileDemo”.
Android implementation makes use of SharedPreferences API which is already defined by Delphi runtime library. You handle that API using an interface named “JSharedPreferences” which is located in Androidapi.JNI.GraphicsContentViewText.
We need to implement most of the TIniFile methods. We can skip the read/write for other data types than string because they are all based on the read/write string.
The class declaration looks like this:
The class TIniFile derives from existing TCustomIniFile. I used the fully qualified class name to avoid confusion (Here it is not strictly necessary since we do not redefine TCustomIniFile).
All the public methods are those required to make TIniFile work as it does under Windows. Private members are required as helpers for the implementation. As their visibility implies, you will never directly use them.
All methods need to get hand on a JSharedPreferences interface. That is why I created a member variable FPrefs to store it and an InitPrefs method to initialize it.
Once you get FPrefs, you may use it to fetch a value. look at ReadString implementation:
FPrefs.GetString is themethod use to retrieve (read) a stored value given his key. Here, as explained above, we implement the concept of section, so the key is really constructed using the section name and the identifier used outside of the class as key.
JStringToString and StringToJString are support functions to marshal back and forth a Delphi string to a Java string (Remember Android API is written in Java).
ReadSection, ReadSections and ReadSectionValues all require to enumerate all keys are save values in a string list for some of the keys if they match a condition. Iterating all the keys is a common process so I moved it to a specialized private method ReadSectionKeysValues.
Here is the implementation:
SharedPreferences Android API make use of string collection returned by getAll method to store all the preferences values. It is a generic Java class which can be accessed using a JMap interface which is available to Delphi program. Accessing the individual strings is 4 steps process:
1) Get the JMap interface by calling getAll
2) Get the JSet interface on behalf f the JMap
3) Get the JIterator on behalf og the JSet
4) Iterate with the JIterator to get hand of all object in the collection
The objects are here JStrings we can convert to Delphi string and process them.
The enumerated strings looks like this: “[Section1]_Key1=Value1”. We can then easily parse the string to extract the parts and do whatever we need with it.
The rest of the class implementation is quite trivial.
http://www.overbyte.be/frame_index.html?redirTo=/blog_source_code.html
FMX.Overbyte.IniFiles.pas
FMX.Overbyte.Android.IniFiles.pas
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
In this article, I will model a class depending on the operation of the well-known Windows INI files. Of course, Windows own system will be used in the Windows implementation. On Android side, I will use the SharedPreferences API which is very close.
INI file concept
In an INI file, you have Key-Value pairs organized by sections. You can read or write values.
Under Windows, the INI file format is a simple text file with a Key=Value per line. All Key-Value pairs related to the same section are grouped under a header line in the form of the section name between brackets.
Under Android, the file format is not specified. You are not supposed to access the file directly. You use a “Shared Preference Editor” to access it. Android API lacks the “section” concept we have in Windows. This is not a problem. To create the section concept, I will simply prefix each key by his section name surrounded by brackets like this: ‘[‘ + Section + ‘]_’ + Key
Delphi TIniFile revisited
Since the beginning, Delphi has a class encapsulation Windows INI files. It is well named “TIniFile” and sits into “System.IniFiles” unit.
I will use the same class name in my implementation and even the save class signature by inheriting from the existing TCustomIniFile for Android and TIniFile for Windows.
Using the same class name as an existing one will force you to pay some attention to the units used in the uses clause, and/or prefix the class name you intent to use with the unit name.
I made things simples. Under both Windows and Android, in your application, you do not use System.IniFiles but FMX.Overbyte.IniFiles. No other change is required. Your application will compile targeted for Windows as well as Android. The conditional compilation is located in FMX.Overbyte.IniFiles and you can safely ignore it!
Storage location
TIniFile constructor takes a filename as argument. This will be the file where the sections and key-value pairs will be stored. The Windows API store the file exactly where you specify it when using a full path. When you omit the path, Windows tore the file in the Windows directory. Since Windows Vista, normal user cannot write to the Windows directory. So it fails.
I slightly changed the base class so that when a full path is omitted, the INI file is stored in the user profile LoaclAppData special directory (non-roaming version). This is a convenient place most of the time. You may always specify a full path name if you want to store it elsewhere.
Android has a “well known” place to store the preference files. We are not supposed to know where. The actual files are not available directly unless your Android device is rooted.
TIniFile constructor in the Android implementation will simple ignore any path you specify and let Android API store the file where it want it to be stored. This could cause a problem if you want to use the same file name for different files stored in different folders. This will cause trouble since the path is ignored.
Windows implementation
The windows implementation is quite trivial since it already exists in Delphi RTL. As stated above, I derived my class from Delphi existing class and only override the constructor to adjust the path when left empty.
The resulting declaration is trivial:
TIniFile = class(System.IniFiles.TIniFile)
public
constructor Create(const AFileName : String);
end;
The implementation is simple:
constructor TIniFile.Create(const AFileName: String);
var
FileName : String;
Path : array [0..1023] of Char;
AppExeName : array [0..1023] of Char;
AppName : String;
LocalAppData : String;
begin
if ExtractFilePath(AFileName) = '' then begin
GetModuleFileName(0, AppExeName, Sizeof(AppExeName));
SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @Path[0]);
AppName := ChangeFileExt(ExtractFileName(AppExeName), '');
LocalAppData := IncludeTrailingPathDelimiter(Path) +
CompanyFolder + '\' + AppName + '\';
FileName := LocalAppData + AFileName;
ForceDirectories(LocalAppData);
end
else
FileName := AFileName;
inherited Create(FileName);
end;
This implementation makes use of SHgetFolderPath API function to get the special directory “LocalAppData” located in each user profile. I used ForceDirectories to create the directory if it does not already exist.
You may want to change the location by changing the constant CSIDL_LOCAL_APPDATA to another one (There is a bunch of such constant, see the API documentation or Delphi source code if you have an edition which includes it).
You may also want to change the string constant “CompanyFolder” to your actual company name instead of OverByte which is my company name.
Using the demo application named “IniFileDemo”, running under Win7, the INI files without path will be stored in “C:\Users\
Android implementation
Android implementation makes use of SharedPreferences API which is already defined by Delphi runtime library. You handle that API using an interface named “JSharedPreferences” which is located in Androidapi.JNI.GraphicsContentViewText.
We need to implement most of the TIniFile methods. We can skip the read/write for other data types than string because they are all based on the read/write string.
The class declaration looks like this:
TIniFile = class(System.IniFiles.TCustomIniFile)
private
FPrefs : JSharedPreferences;
function InitPrefs : JSharedPreferences;
function Key(const Section, Ident : String) : JString;
procedure ReadSectionKeysValues(const Section : String;
const KeyOnly : Boolean;
Strings : TStrings);
public
constructor Create(const FileName: String);
function ReadString(const Section, Ident, Default: String): String; override;
procedure WriteString(const Section, Ident, Value: String); override;
procedure ReadSection(const Section: String; Strings: TStrings); override;
procedure ReadSections(Strings: TStrings); override;
procedure ReadSectionValues(const Section: String; Strings: TStrings); override;
procedure DeleteKey(const Section, Ident: String); override;
procedure EraseSection(const Section: string); override;
procedure UpdateFile; override;
end;
The class TIniFile derives from existing TCustomIniFile. I used the fully qualified class name to avoid confusion (Here it is not strictly necessary since we do not redefine TCustomIniFile).
All the public methods are those required to make TIniFile work as it does under Windows. Private members are required as helpers for the implementation. As their visibility implies, you will never directly use them.
All methods need to get hand on a JSharedPreferences interface. That is why I created a member variable FPrefs to store it and an InitPrefs method to initialize it.
Once you get FPrefs, you may use it to fetch a value. look at ReadString implementation:
function TIniFile.ReadString(const Section, Ident, Default: String): String;
begin
InitPrefs;
Result := JStringToString(FPrefs.GetString(Key(Section, Ident),
StringToJString(Default)));
end;
FPrefs.GetString is themethod use to retrieve (read) a stored value given his key. Here, as explained above, we implement the concept of section, so the key is really constructed using the section name and the identifier used outside of the class as key.
JStringToString and StringToJString are support functions to marshal back and forth a Delphi string to a Java string (Remember Android API is written in Java).
ReadSection, ReadSections and ReadSectionValues all require to enumerate all keys are save values in a string list for some of the keys if they match a condition. Iterating all the keys is a common process so I moved it to a specialized private method ReadSectionKeysValues.
Here is the implementation:
procedure TIniFile.ReadSectionKeysValues(
const Section : String; // Section to read, or empty for keys and values
const KeyOnly : Boolean;
Strings : TStrings);
var
AMap : JMap;
ASet : JSet;
AIter : JIterator;
AObj : JObject;
AString : JString;
DString : String;
ASection : String;
AIdent : String;
I, J : Integer;
begin
if not Assigned(Strings) then
Exit;
InitPrefs;
Strings.Clear;
AMap := FPrefs.GetAll;
if not Assigned(AMap) then
Exit;
ASet := AMap.entrySet;
if not Assigned(ASet) then
Exit;
AIter := ASet.iterator;
Strings.BeginUpdate;
while AIter.hasNext do begin
AObj := AIter.next;
AString := AObj.toString;
DString := JStringToString(AString);
// We get "[Section]_Ident"
if (Length(DString) > 3) and (DString[Low(DString)] = '[') then begin
I := Pos(']', DString);
if I > 0 then begin
ASection := Copy(DString, 2, I - 2);
if Section = '' then begin
// We are reading section names
if Strings.IndexOf(ASection) < 0 then
Strings.Add(ASection);
end
else if SameText(Section, ASection) then begin
// We are reading the key names (Ident)
if KeyOnly then
J := PosEx('=', DString)
else
J := Length(DString) + 1;
if J > 0 then begin
AIdent := Copy(DString, I + 2, J - I - 2);
Strings.Add(AIdent);
end;
end;
end;
end;
end;
Strings.EndUpdate;
end;
SharedPreferences Android API make use of string collection returned by getAll method to store all the preferences values. It is a generic Java class which can be accessed using a JMap interface which is available to Delphi program. Accessing the individual strings is 4 steps process:
1) Get the JMap interface by calling getAll
2) Get the JSet interface on behalf f the JMap
3) Get the JIterator on behalf og the JSet
4) Iterate with the JIterator to get hand of all object in the collection
The objects are here JStrings we can convert to Delphi string and process them.
The enumerated strings looks like this: “[Section1]_Key1=Value1”. We can then easily parse the string to extract the parts and do whatever we need with it.
The rest of the class implementation is quite trivial.
Full source code
The source code as well as a demo application is available from my website athttp://www.overbyte.be/frame_index.html?redirTo=/blog_source_code.html
FMX.Overbyte.IniFiles.pas
unit FMX.Overbyte.IniFiles;
{$DEFINE OVERBYTE_INCLUDE_MODE}
{$IFDEF ANDROID}
{$I FMX.Overbyte.Android.IniFiles.pas}
{$ENDIF}
{$IFDEF MSWINDOWS}
{$I FMX.Overbyte.Windows.IniFiles.pas}
{$ENDIF}
FMX.Overbyte.Windows.IniFiles.pas
{$IFNDEF OVERBYTE_INCLUDE_MODE}
unit FMX.Overbyte.Windows.IniFiles;
{$ENDIF}
interface
uses
System.SysUtils, System.Classes, System.IniFiles,
WinApi.Windows,
WinApi.ShlObj;
const
CompanyFolder = 'OverByte';
type
// We are enhancing Embarcadero implementation
TIniFile = class(System.IniFiles.TIniFile)
public
constructor Create(const AFileName : String);
end;
implementation
{ TIniFile }
constructor TIniFile.Create(const AFileName: String);
var
FileName : String;
Path : array [0..1023] of Char;
AppExeName : array [0..1023] of Char;
AppName : String;
LocalAppData : String;
begin
// When the path is empty, Windows use Windows directory (C:\windows). This
// is bad since Win7 which requires special permission to write to this
// directory.
// This implementation redirect the INI file to the user profile, that is
// \Local Settings\Application Data (non roaming)
// If you really want to write to Windows directory, then you must
// specify that path name specifically.
if ExtractFilePath(AFileName) = '' then begin
GetModuleFileName(0, AppExeName, Sizeof(AppExeName));
SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @Path[0]);
AppName := ChangeFileExt(ExtractFileName(AppExeName), '');
LocalAppData := IncludeTrailingPathDelimiter(Path) +
CompanyFolder + '\' + AppName + '\';
FileName := LocalAppData + AFileName;
ForceDirectories(LocalAppData);
end
else
FileName := AFileName;
inherited Create(FileName);
end;
end.
FMX.Overbyte.Android.IniFiles.pas
{$IFNDEF OVERBYTE_INCLUDE_MODE}
unit FMX.Overbyte.Android.IniFiles;
{$ENDIF}
interface
uses
System.SysUtils, System.Classes, System.IniFiles, System.StrUtils,
FMX.Helpers.Android,
Androidapi.NativeActivity,
Androidapi.JNI,
Androidapi.JNI.App,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.JavaTypes;
type
TIniFile = class(System.IniFiles.TCustomIniFile)
private
FPrefs : JSharedPreferences;
function InitPrefs : JSharedPreferences;
function Key(const Section, Ident : String) : JString;
procedure ReadSectionKeysValues(const Section : String;
const KeyOnly : Boolean;
Strings : TStrings);
public
constructor Create(const FileName: String);
function ReadString(const Section, Ident, Default: String): String; override;
procedure WriteString(const Section, Ident, Value: String); override;
procedure ReadSection(const Section: String; Strings: TStrings); override;
procedure ReadSections(Strings: TStrings); override;
procedure ReadSectionValues(const Section: String; Strings: TStrings); override;
procedure DeleteKey(const Section, Ident: String); override;
procedure EraseSection(const Section: string); override;
procedure UpdateFile; override;
end;
implementation
{ TIniFile }
constructor TIniFile.Create(const FileName: String);
begin
// Under Android, just ignore the path part because Android has a well
// known place to store preferences files
inherited Create(ExtractFileName(FileName));
end;
procedure TIniFile.DeleteKey(const Section, Ident: String);
var
Edit : JSharedPreferences_Editor;
begin
InitPrefs;
Edit := FPrefs.Edit;
Edit.Remove(Key(Section, Ident));
Edit.Apply;
end;
procedure TIniFile.EraseSection(const Section: String);
var
Idents : TStringList;
Edit : JSharedPreferences_Editor;
I : Integer;
begin
Idents := TStringList.Create;
ReadSectionKeysValues(Section, TRUE, Idents);
InitPrefs;
Edit := FPrefs.Edit;
for I := 0 to Idents.Count - 1 do
Edit.Remove(Key(Section, Idents[I]));
Edit.Apply;
end;
function TIniFile.InitPrefs : JSharedPreferences;
begin
if not Assigned(FPrefs) then
FPrefs := SharedActivityContext.getSharedPreferences(
StringToJString(FileName),
TJActivity.JavaClass.MODE_PRIVATE);
Result := FPrefs;
end;
function TIniFile.Key(const Section, Ident: String): JString;
begin
Result := StringToJString('[' + Section + ']_' + Ident);
end;
procedure TIniFile.ReadSection(const Section: String; Strings: TStrings);
begin
if Section = '' then begin
if Assigned(Strings) then
Strings.Clear;
end
else
ReadSectionKeysValues(Section, TRUE, Strings);
end;
procedure TIniFile.ReadSections(Strings: TStrings);
begin
ReadSectionKeysValues('', FALSE, Strings);
end;
procedure TIniFile.ReadSectionKeysValues(
const Section : String; // Section to read, or empty for keys and values
const KeyOnly : Boolean;
Strings : TStrings);
var
AMap : JMap;
ASet : JSet;
AIter : JIterator;
AObj : JObject;
AString : JString;
DString : String;
ASection : String;
AIdent : String;
I, J : Integer;
begin
if not Assigned(Strings) then
Exit;
InitPrefs;
Strings.Clear;
AMap := FPrefs.GetAll;
if not Assigned(AMap) then
Exit;
ASet := AMap.entrySet;
if not Assigned(ASet) then
Exit;
AIter := ASet.iterator;
Strings.BeginUpdate;
while AIter.hasNext do begin
AObj := AIter.next;
AString := AObj.toString;
DString := JStringToString(AString);
// We get "[Section]_Ident"
if (Length(DString) > 3) and (DString[Low(DString)] = '[') then begin
I := Pos(']', DString);
if I > 0 then begin
ASection := Copy(DString, 2, I - 2);
if Section = '' then begin
// We are reading section names
if Strings.IndexOf(ASection) < 0 then
Strings.Add(ASection);
end
else if SameText(Section, ASection) then begin
// We are reading the key names (Ident)
if KeyOnly then
J := PosEx('=', DString)
else
J := Length(DString) + 1;
if J > 0 then begin
AIdent := Copy(DString, I + 2, J - I - 2);
Strings.Add(AIdent);
end;
end;
end;
end;
end;
Strings.EndUpdate;
end;
procedure TIniFile.ReadSectionValues(const Section: String; Strings: TStrings);
begin
if Section = '' then
Strings.Clear
else
ReadSectionKeysValues(Section, FALSE, Strings);
end;
function TIniFile.ReadString(const Section, Ident, Default: String): String;
begin
InitPrefs;
Result := JStringToString(FPrefs.GetString(Key(Section, Ident),
StringToJString(Default)));
end;
procedure TIniFile.UpdateFile;
begin
// Nothing to do
end;
procedure TIniFile.WriteString(const Section, Ident, Value: String);
var
Edit : JSharedPreferences_Editor;
begin
InitPrefs;
Edit := FPrefs.Edit;
Edit.PutString(Key(Section, Ident), StringToJString(Value));
Edit.Apply;
end;
end.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
Labels:
Android,
API,
delphi,
FireMonkey,
Mobile,
Mobile Development,
opensource,
pascal,
programming
December 28, 2013
Compiling to native code begets better performance
Todays with Mobile platforms such as IOS and Android, developers are faced with writing application targeted to several platforms. Of course developers want to do that with minimal effort. This is why the market of cross platform tools is growing.
Embarcadero do it well with RAD Studio XE5 (Includes Delphi and C++ Builder). There is an interesting article on NetworkWorld talking about the subject and comparing different solutions.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
Embarcadero do it well with RAD Studio XE5 (Includes Delphi and C++ Builder). There is an interesting article on NetworkWorld talking about the subject and comparing different solutions.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
Labels:
Android,
ARM,
C++Builder,
delphi,
embarcadero,
IOS,
Mobile,
Mobile Development,
RAD Studio
December 18, 2013
Mandelbrot Explorer for Android and Windows
Using Delphi XE5, I rewrote my Mandelbrot fractal explorer with the FireMonkey component framework. The result is a working application for Android and Windows. To generate Windows or Android version, it is enough to just change the target operating system. Nice cross-platform application!
On the picture below, you see the Windows version running on my desktop and the Android version running on my Nexus 7 device.
The source code is making use of what I described in two previous articles:
http://francois-piette.blogspot.be/2013/12/firemonkey-android-windows-and.html
http://francois-piette.blogspot.be/2013/12/mandelbrot-fractal-explorer.html
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
December 11, 2013
Update 2 for RAD Studio XE5, Delphi XE5 and C++Builder XE5
If you have not noticed yet, Embarcadero published the second update for their latest tools: Delphi XE5 as well as RAD Studio XE5 and C++ Builder XE5.
More than one hundred bugs have been fixed. Thanks for the users having taken the time to write a bug report to Quality Central, the web tool used to keep track of bugs and feature requests.
Most fixed bugs are related to the mobile platforms and FireMonkey component set. Obviously the Windows, RTL and VCL parts of the product are very stable.
The update is available freely for registered users of the product.
Download from http://cc.embarcadero.com/item/29662
There is also an article with a partial list of fixes: http://dn.embarcadero.com/article/43522
Update 16/12/2013: Hot fixes are available: HF1 and HF2
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
More than one hundred bugs have been fixed. Thanks for the users having taken the time to write a bug report to Quality Central, the web tool used to keep track of bugs and feature requests.
Most fixed bugs are related to the mobile platforms and FireMonkey component set. Obviously the Windows, RTL and VCL parts of the product are very stable.
The update is available freely for registered users of the product.
Download from http://cc.embarcadero.com/item/29662
There is also an article with a partial list of fixes: http://dn.embarcadero.com/article/43522
Update 16/12/2013: Hot fixes are available: HF1 and HF2
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
This article is available from http://francois-piette.blogspot.be
Labels:
Android,
C++Builder,
delphi,
embarcadero,
FireMonkey,
FMX,
IDE,
IOS,
Mobile,
Mobile Development,
RAD,
RAD Studio,
VCL,
XE5
October 5, 2013
All about Delphi XE5 and mobile development
CodeRage 8
is just around the corner on October 15th through 17th.
This online event is completely free and full of technical sessions all about
Delphi XE5 and mobile development.
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
August 20, 2013
Delphi XE5 to develop Android applications
Delphi XE5 is about to be announced. I have the chance to use a preview version for several weeks now. I’m very impressed!
Using Delphi XE5 I was able to write my first Android application and deploy it to my Nexus 7 in a couple of minutes. OK, for now it is a very basic application: I just took one of the predefined application templates, added a few buttons and labels, hit F9. After a few seconds, the application was compiled and deployed on my Nexus 7 connected to my PC with an USB cable. The application was up and running and I was able to debug it. Waouw!
As you know, I the author of the Internet Component Suite (aka ICS). ICS is about internet programming according to the asynchronous non-blocking programming model. I already started porting my code to Android.
Delphi XE5 is a native compiler for Android. It means Delphi XE5 compile into ARM machine language. It is neither Java nor running under a Java Virtual Machine (Renamed Dalvik on Android). No, Delphi XE5 produces native code which runs fast.
This will help me porting ICS to Android because Delphi XE5 gives me access to the underlying operating system which is… Linux! ICS is all about low level programming and I’m very happy about how it is done in XE5.
Of course XE5 comes with the famous FireMonkey framework (FMX) which covers a lot of thing. The most noticeable is the user interface. For ICS I don’t care about the user interface but of course most application using ICS do. They will simply use FMX. And guess what? FMX is cross platform: the same components (You know edits, labels and hundreds of UI components) can be used for Windows, Android, iOS and MAC OSx.
In the upcoming blog articles, I will enter in more details about Delphi XE5. Stay tuned!
Note: This article is based on a preview version (beta). Retail product may be different. I have been given special permission from Embarcadero to speak about XE5 despite the NDA covering the beta version.
Visit the official RAD Studio/Delphi Android page: http://embt.co/RADAndroid
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
Using Delphi XE5 I was able to write my first Android application and deploy it to my Nexus 7 in a couple of minutes. OK, for now it is a very basic application: I just took one of the predefined application templates, added a few buttons and labels, hit F9. After a few seconds, the application was compiled and deployed on my Nexus 7 connected to my PC with an USB cable. The application was up and running and I was able to debug it. Waouw!
As you know, I the author of the Internet Component Suite (aka ICS). ICS is about internet programming according to the asynchronous non-blocking programming model. I already started porting my code to Android.
Delphi XE5 is a native compiler for Android. It means Delphi XE5 compile into ARM machine language. It is neither Java nor running under a Java Virtual Machine (Renamed Dalvik on Android). No, Delphi XE5 produces native code which runs fast.
This will help me porting ICS to Android because Delphi XE5 gives me access to the underlying operating system which is… Linux! ICS is all about low level programming and I’m very happy about how it is done in XE5.
Of course XE5 comes with the famous FireMonkey framework (FMX) which covers a lot of thing. The most noticeable is the user interface. For ICS I don’t care about the user interface but of course most application using ICS do. They will simply use FMX. And guess what? FMX is cross platform: the same components (You know edits, labels and hundreds of UI components) can be used for Windows, Android, iOS and MAC OSx.
In the upcoming blog articles, I will enter in more details about Delphi XE5. Stay tuned!
Note: This article is based on a preview version (beta). Retail product may be different. I have been given special permission from Embarcadero to speak about XE5 despite the NDA covering the beta version.
Visit the official RAD Studio/Delphi Android page: http://embt.co/RADAndroid
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
Labels:
Android,
delphi,
embarcadero,
FMX,
ICS,
IOS,
Mobile,
Mobile Development,
RAD
August 14, 2013
Android application with Delphi
The next version of Delphi will include a new compiler for the Android ARM Platform. This compiler is based on LLVM architecture like Delphi for IOS compiler. It will produce native code (That is ARM assembly language) which is executed on your device (Phone, tablet of whatever).
You''ll said: Native? I tough that Android was Java. Actually no. Android is based on Linux and has of course a physical processor. Most implementations use ARM architecture, but not all.
Every Android application is a Java application. Well, almost. The truth is that the entry point for an Android process must be in a Java application. This application may be minimal, just a simple class with the only role of loading the native code. Android for Delphi will create a shared object Library containing everything you coded in Delphi. This shared object will be loaded by a minimal application - included with Delphi - that will load the shared object. So what the user see is an normal Android application.
Everything is done transparently for you. You write your Delphi application the usual way, you hit F9, after compilation, Delphi automatically creates an APK (an Android Package Application) with all required files (manifest, resources, and the binary), Delphi deploy the application to your device using Platform Tools, and start it.
To deploy your application using Delphi, you must connect your device thru USB and enable USB debugging on it. You can also deploy the application thru GMail by sending a mail to the user which can then accept to install it on his device. No need to send your application to Android Play Store!
To do all this magic, Delphi for Android requires both the NDK and the SDK to be available on the developer machine. The SDK and NDK are free of charge from Google.
Source: http://blog.marcocantu.com/blog/compiling_android_apps_delphi.html and http://blog.marcocantu.com/blog/fire_icons_nexus_4.html
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
You''ll said: Native? I tough that Android was Java. Actually no. Android is based on Linux and has of course a physical processor. Most implementations use ARM architecture, but not all.
![]() |
| Look at the 4 Delphi for Android default icons |
Every Android application is a Java application. Well, almost. The truth is that the entry point for an Android process must be in a Java application. This application may be minimal, just a simple class with the only role of loading the native code. Android for Delphi will create a shared object Library containing everything you coded in Delphi. This shared object will be loaded by a minimal application - included with Delphi - that will load the shared object. So what the user see is an normal Android application.
Everything is done transparently for you. You write your Delphi application the usual way, you hit F9, after compilation, Delphi automatically creates an APK (an Android Package Application) with all required files (manifest, resources, and the binary), Delphi deploy the application to your device using Platform Tools, and start it.
To deploy your application using Delphi, you must connect your device thru USB and enable USB debugging on it. You can also deploy the application thru GMail by sending a mail to the user which can then accept to install it on his device. No need to send your application to Android Play Store!
To do all this magic, Delphi for Android requires both the NDK and the SDK to be available on the developer machine. The SDK and NDK are free of charge from Google.
Source: http://blog.marcocantu.com/blog/compiling_android_apps_delphi.html and http://blog.marcocantu.com/blog/fire_icons_nexus_4.html
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
August 11, 2013
A first look at Delphi for Android
Delphi for Android has been in beta for a while now. The progress has been awesome. Since a few months, Delphi for iOS allowed us to build applications for iPhone and iPad. Now with Delphi for Android, you can simply change the target and rebuild it for Android. It's really Amazing said John Ray Thomas (AKA "JT"), director of Product Management at Embarcadero technologies.
On his blog, JT published a number of photos showing the same application running on an iPhone 5, A Samsung Galaxy S4 and an Nexus 7 tablet.
For those willing to dig into Delphi for Android, the beta program is open to the public: Register here
The roadmap for Delphi is here: http://francois-piette.blogspot.be/2013/08/rad-studio-mobile-roadmap-updated.html
Source: John Thomas blog
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
On his blog, JT published a number of photos showing the same application running on an iPhone 5, A Samsung Galaxy S4 and an Nexus 7 tablet.
For those willing to dig into Delphi for Android, the beta program is open to the public: Register here
The roadmap for Delphi is here: http://francois-piette.blogspot.be/2013/08/rad-studio-mobile-roadmap-updated.html
Source: John Thomas blog
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
August 8, 2013
RAD Studio Mobile Roadmap updated
Embarcadero updated his RAD Studio Mobile Roadmap. This concern Delphi and C++ Builder for Android and iOS.
- NDK based Android Platform support (Gingerbread, ICS and Jelly Bean)
- FireMonkey mobile Framework for Android
- Mobile designer for Android
- iOS 7 support
- Mobile sensor support for Android (GPS, Camera, Gyro, Accelerometer)
- Advertizing and payment for Android and iOS
- Native Android UX w/Native UI styles
- iOS 7 UX w/Native UI style
- High performance iOS and Android mobiel DACs for popular databases
- Interbase Lite and IBtoGo for Android support
- Datasnap middleware mobile enterprise enhancements
- Cross Platform desktop/tablet/phone
- Automatic retina/Hi-Res display handling
- Integrated Android Design, development, simulation, debugging and deployment
- Rest client Framework and mobile BaaS support
- Ad Hoc and AppStore deployment
- C++ Builder for Android: estimated winter 2013
Source: http://edn.embarcadero.com/article/42544
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
What is in development:
- Integrated C++ and Delphi Native ARM toolchains for iOS and Android (compiler, linker, debugger)- NDK based Android Platform support (Gingerbread, ICS and Jelly Bean)
- FireMonkey mobile Framework for Android
- Mobile designer for Android
- iOS 7 support
- Mobile sensor support for Android (GPS, Camera, Gyro, Accelerometer)
- Advertizing and payment for Android and iOS
- Native Android UX w/Native UI styles
- iOS 7 UX w/Native UI style
- High performance iOS and Android mobiel DACs for popular databases
- Interbase Lite and IBtoGo for Android support
- Datasnap middleware mobile enterprise enhancements
- Cross Platform desktop/tablet/phone
- Automatic retina/Hi-Res display handling
- Integrated Android Design, development, simulation, debugging and deployment
- Rest client Framework and mobile BaaS support
- Ad Hoc and AppStore deployment
Roadmap:
- Delphi for Android: estimated fall 2013- C++ Builder for Android: estimated winter 2013
Source: http://edn.embarcadero.com/article/42544
Follow me on Twitter
Follow me on LinkedIn
Follow me on Google+
Visit my website: http://www.overbyte.be
Subscribe to:
Posts (Atom)


