Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkeyWindows

Get Your App Icon With Delphi XE5 Firemonkey On Android And Windows

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey Android APK Icon | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSChris Rolliston put up a blog post about a month ago that has some sample code for accessing the icon from your Android APK file and your Windows binary file. The original blog post (here) only supported Android but then he made a second blog post which supports getting the icon file from your binary on Windows as well as the APK on Android. It uses the PackageManager API on Android which is actually a pretty powerful API that lets you access all of the information about all of the packages installed on the device (if you have the right permissions). You could for example read the icons of other packages on the device (using the getApplicationIcon() function) and use them within Delphi XE5 Firemonkey. The function for accessing a list of all the apps installed on the device is called getInstalledApplications(). The core of the get app icon code is:

  Activity := SharedActivity;
  Drawable := Activity.getPackageManager.getApplicationIcon(Activity.getApplicationInfo);
  Bitmap := TJBitmapDrawable.Wrap((Drawable as ILocalObject).GetObjectID).getBitmap;

Head over and view the full source of the function on his blog to access the app icon on Android.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging


Unleashing Creativity With Song Writer AI: A Deep Dive


How To Build Stable Diffusion Text To Image Prompts


FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

Leave a Reply