Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Get application icon using Symbian C++

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Created: symbianyucca (20 Mar 2007)
Last edited: lpvalente (12 Jul 2014)

Following code sample can be used to retrieve application icons

Hearders Required:

#include <fbs.h> //CFbsBitmap
#include <aknsskininstance.h> //MAknsSkinInstance
#include <aknsutils.h> //AknsUtils

Library required:

LIBRARY fbscli.lib ///CFbsBitmap
LIBRARY aknskins.lib aknskinsrv.lib aknswallpaperutils.lib //MAknsSkinInstance ,AknsUtils

Source Code:

CGulIcon* CMyClass::GetApplicationIconL(const TUid& aAppUID)
CFbsBitmap* AppIcon(NULL);
CFbsBitmap* AppIconMsk(NULL);
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
AknsUtils::CreateAppIconLC(skin,aAppUID, EAknsAppIconTypeContext,AppIcon,AppIconMsk);
return CGulIcon::NewL(AppIcon,AppIconMsk);

You could get application UIDs from TApaAppInfo, which you could get for example by using the code sample shown in here

A known issue:

The utility function doesn't need any capability if you are creating app icons of Symbian OS C++ applications. But when getting the app icons of Java applications the AllFiles capability is required. As it is less possible for a normal application to have AllFiles capability, it is suggested to add error handling code like this:

// first try to use the utility function
TRAPD(err, AknsUtils::CreateAppIconL(...))
// if it failed then use the traditional way
err = RApaLsSession::GetAppIcon();
// if both of them failed then
// load a default icon for the application

References How to get Application Icon using RApaLsSession

This page was last modified on 12 July 2014, at 19:14.
44 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.