hi there, i need help here ... i'm trying to get some of the details from the contact database in a phone such as name and phone num.Is there any available sample source code that i can have a look on it . by the way i did try to code myself by mixing my logic and other ppls source code that i get from this forum a.There is no copilation error but when i trigger the app in the emulor it just jump off returning an error. Can you guys have a look on my code .and tell me whats the problem......

void CBubbleBasicAppView::ConstructL(const TRect& aRect)
{

CreateWindowL();

// Set the windows size
SetRect(aRect);
iMsgIndex = 0;

// Create a control to display a list of messages
iListBox = new (ELeave) CAknSingleNumberStyleListBox;
iListBox->SetContainerWindowL(*this);
iListBox->ConstructL(this, 0);

iListBox->SetRect(aRect.Size());

iListBox->ActivateL();
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
iListBox->SetDimmed(ETrue);
// Create an array to hold the messages
iContactList = new (ELeave) CDesCArrayFlat(10);

//Open the contacts database
CContactDatabase* contactsDb = CContactDatabase::OpenL( );
CleanupStack::PushL( contactsDb );
static const TInt KMaxTIntLen = 4000;
HBufC* buffer = HBufC::NewLC(KMaxTIntLen) ;
const CContactIdArray* items = contactsDb->SortedItemsL();
//Search through the DB
for ( TInt i = 0 ; i < items->Count( ) ; i++ ){
const TContactItemId id = (*items)[i];
CContactItem* item = contactsDb->ReadContactL( id ) ;
CContactItemFieldSet& fields = item->CardFields() ;

for ( TInt j = 0 ; j < fields.Count() ; j++ ){
const CContactItemField& field = fields[j];
const CContentType& contentType = field.ContentType();
TStorageType TType = field.StorageType( );
if ( TType == KStorageTypeText && contentType.Mapping() == KUidContactFieldPhoneNumber ){
CContactTextField* text = field.TextStorage();
if( text->Text().Size( ) > 0 ){
buffer->Des().Append('\t');
buffer->Des().Append(text->Text() );
iContactList->AppendL(*buffer);
iListBox->HandleItemAdditionL();
break;
}
}
}

}


CleanupStack::PopAndDestroy();
// Give it to the control
CTextListBoxModel* model = iListBox->Model();
model->SetItemTextArray(iContactList);
model->SetOwnershipType(ELbmOwnsItemArray); // transfer ownership of iMessageList


// Activate the window, which makes it ready to be drawn
ActivateL();



}