Initial contribution of the Adaptation Documentation.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-3B441CDC-AB7A-4D8D-A595-57C21E1D426C" xml:lang="en"><title>Foreground
events</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The application framework calls <xref href="GUID-92361912-7768-3D2C-835E-BD3EF1366D6D.dita#GUID-92361912-7768-3D2C-835E-BD3EF1366D6D/GUID-71F5C50E-2595-3B8E-850A-6DB0CFBB091D"><apiname>CCoeAppUI::HandleForegroundEventL()</apiname></xref> when
the application is switched to the foreground or background.</p>
<p>While the default implementation of this method is empty, it can be,
for example, used to display messages or pause a game when a focus change
event occurs.</p>
<p>An example of such a foreground event implementation is as follows:</p>
<codeblock id="GUID-ECF10193-AB06-4267-A47F-D5EC2C561D9C" xml:space="preserve">// ------------------------------------------------------------------------------
// CMyViewAppUi::HandleForegroundEventL(TBool aForeground)
// This function is called by the framework when the screen loses or gains focus.
// i.e. when it goes to the background or to the foreground. Incoming call
// softnote is an example.
// This event applies to the entire application, all views.
// ------------------------------------------------------------------------------
//
void CMyViewAppUi::HandleForegroundEventL(TBool aForeground)
{
if( aForeground == TRUE )
{
iEikonEnv->InfoMsg( _L( "Foreground true" ) );
}
else
{
iEikonEnv->InfoMsg( _L( "Foreground false" ) );
}
}
</codeblock>
<p>The <parmname>aForeground</parmname> parameter is true if the application
is switched to the foreground (is visible) and false if the application has
gone to the background.</p>
<note>
<p>The above code snippet uses the <i>MyView</i> example application provided
in the <i> Platform Application Views</i> package available from <xref href="http://www.forum.nokia.com/info/sw.nokia.com/id/226649f9-4118-4c8a-92e6-6d72fb251ae1/S60_Platform_Application_Views_v2_1_en.zip.html" scope="external">Forum
Nokia</xref> . </p>
</note>
</conbody></concept>