Hello,
I am writing an application in which i am intercepting a incomming GSM call and showing the number of the incomming call.
Before th GSM call arrives my view is different and as soon as there is an incomming GSM call i retrive the number and show it in a list box in a different view.Following is the code of the listbox view.
// INCLUDE FILES
#include <coemain.h>
#include <aknlists.h>
#include <badesca.h>
#include "CallingViewAppView.h"
#include "SampleAppUi.h"
#include <Sample_0xEC7B4304.rsg>
#include <aknquerydialog.h>
#include <eikenv.h>
#define KListPosition TPoint(0,0)
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CCallingViewAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CCallingViewAppView* CCallingViewAppView::NewL( const TRect& aRect,CSampleAppUi* iAppUi )
{
CCallingViewAppView* self = CCallingViewAppView::NewLC( aRect,iAppUi );
CleanupStack::Pop( self );
return self;
}
// -----------------------------------------------------------------------------
// CCallingViewAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CCallingViewAppView* CCallingViewAppView::NewLC( const TRect& aRect,CSampleAppUi* iAppUi )
{
CCallingViewAppView* self = new ( ELeave ) CCallingViewAppView;
CleanupStack::PushL( self );
self->ConstructL( aRect,iAppUi );
return self;
}
// -----------------------------------------------------------------------------
// CCallingViewAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CCallingViewAppView::ConstructL( const TRect& aRect,CSampleAppUi* iAppUi )
{
// Create a window for this application view
CreateWindowL();
appUI=iAppUi;
list = new (ELeave) CAknDoubleStyleListBox;
SFW::LogMe(_L8("List Box created\r\n"));
// construct listbox
list->ConstructL(this,0);
queryBoxFlag=ETrue;
// set container control
list->SetContainerWindowL(*this);
list->SetListBoxObserver(this);
// add scrollbars to listbox
list->CreateScrollBarFrameL(ETrue);
list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );
_LIT(KListItemFormat, "\t%S\t%S\t");
_LIT(KListDialled,"Calling....");
_LIT(KListIncoming,"Incoming Call....");
_LIT(KSubString,"Number");
// construct listbox item array
CDesCArray* itemList = static_cast<CDesCArray*>(list->Model()->ItemTextArray());
itemList->Reset();
TBuf<120> item;
TBuf<30> itemName;
TBuf<30> itemSubString;
if(appUI->IsCalling)
itemName.Copy(KListDialled);
else if (appUI->GotCalled)
itemName.Copy(KListIncoming);
itemSubString.Copy(KSubString);
TBuf<30>TargetIdNum=appUI->remoteId);
item.Format(KListItemFormat, &itemName,&(TargetIdNum));
itemList->AppendL(item);
list->HandleItemAdditionL();
list->SetCurrentItemIndex(0);
// Set the windows size
SetRect( aRect );
// Activate the window, which makes it ready to be drawn
ActivateL();
}
// -----------------------------------------------------------------------------
// CCallingViewAppView::CCallingViewAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CCallingViewAppView::CCallingViewAppView()
{
// No implementation required
}
// -----------------------------------------------------------------------------
// CCallingViewAppView::~CCallingViewAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CCallingViewAppView::~CCallingViewAppView()
{
delete list;
}
// -----------------------------------------------------------------------------
// CCallingViewAppView:raw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void CCallingViewAppView:raw( /*const TRect& aRect*/ ) const
{
// Get the standard graphics context
CWindowGc& gc = SystemGc();
// Gets the control's extent
TRect drawRect( Rect());
// Clears the screen
gc.Clear( drawRect );
}
void CCallingViewAppView::SizeChanged()
{
if(list)
{
list->SetExtent (KListPosition, list->MinimumSize());
}
}
TInt CCallingViewAppView::CountComponentControls() const
{
return 1; // return number of controls inside this container
}
CCoeControl* CCallingViewAppView::ComponentControl(TInt aIndex) const
{
switch (aIndex)
{
case 0:
if(list)
{
return list;
}
default:
return NULL;
}
}
TKeyResponse CCallingViewAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
if ( aType != EEventKey )
{
return EKeyWasNotConsumed;
}
if ( list )
{
return list->OfferKeyEventL( aKeyEvent, aType );
}
return EKeyWasNotConsumed;
}
void CCallingViewAppView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aListBoxEvent)
{
}
// ---------------------------------------------------------
// CAreciboPhoneBookView::HandleControlEventL()
// ---------------------------------------------------------
//
void CCallingViewAppView::HandleControlEventL(
CCoeControl* /*Control*/,TCoeEvent /*aEventType*/)
{
}
TBool CCallingViewAppView::KeyCapturedL(TWsEvent aEvent)
{
}
now many a times my application crashes at ActivateL function.It does not happen in all cases but it does happens after few calls,
Can any body guess the reason behind it .It gives KERN - EXEC 3 while crashing.
Regards
symbiannil

raw()


