An application can register as an observer of a view by implementing the following observer interfaces. Observers can register with the View Server as activation observers, deactivation observers or as generic observers.
| Interface | Notification | Method to override | 
|---|---|---|
| 
 | View activation notification for the specified view. | IMPORT_C void NotifyNextActivation(TVwsViewId& aViewId, MCoeViewActivationObserver& aViewActivationObserver) | 
| 
 | View activation notification for any view registered with view server. | IMPORT_C void NotifyNextActivation(MCoeViewActivationObserver& aViewActivationObserver) | 
| 
 | View deactivation notification for the specified view. | IMPORT_C void NotifyNextDeactivation (TVwsViewId& aViewId, MCoeViewDeactivationObserver& aViewDeactivationObserver) | 
| 
 | View deactivation notification for any view registered with view server. | IMPORT_C void NotifyNextDeactivation (MCoeViewDeactivationObserver& aViewDeactivationObserver) | 
The following code snippet shows implementing the MCoeViewActivationObserver observer
interface class:
/** 
CMCoeViewActivationObserver  - implements the MCoeViewActivationObserver interface for notifications only
*/
CMCoeViewActivationObserver* CMCoeViewActivationObserver::NewL()    
    {
    CMCoeViewActivationObserver* self=new( ELeave ) CMCoeViewActivationObserver();
    return self;
    }
void CMCoeViewActivationObserver::HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId,
                                                        const TVwsViewId& aViewIdToBeDeactivated )    
    {_
    LIT( Kmessage, "Notified MCoeViewActivationObserver::HandleViewActivation: Newly Active View: 0x%x - Deactivate 0x%x" )    
    INFO_PRINTF2( Kmessage, aNewlyActivatedViewId.iViewUid.iUid, aViewIdToBeDeactivated.iViewUid.iUid );
    }