Namespaces
Variants
Actions
(Redirected from Get application icon)

Get application icon using Symbian C++

Jump to: navigation, search
Article Metadata

Article
Created: symbianyucca (20 Mar 2007)
Last edited: hamishwillee (08 May 2013)

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);
CleanupStack::Pop(2);
 
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(err!=KErrNone)
{
// if it failed then use the traditional way
err = RApaLsSession::GetAppIcon();
}
if(err!=KErrNone)
{
// 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 8 May 2013, at 09:47.
320 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved