Hi all:
I spcified a TContactItemId, and how can I check the item with the Id exists in the current contact database?
Hi all:
I spcified a TContactItemId, and how can I check the item with the Id exists in the current contact database?
Hi,
Try with this function FindLC() in CContactDatabase.
Also check CAknSearchField.
Cheer's
FindLC uses TDesC so is useless if you want to searc based on TContactItemId. A better solution would be to use SortedItemsL() or to create a LocaView....but this is an ugly solutionOriginally Posted by marvik_34
![]()
Did u try using:-
CContactItem* CContactDatabase::ReadContactL(TContactItemId aContactId);
It will give u what you are looking for.
Cheers
mayank
Yeah, I took use of the leave code of OpenContactL to achieve that. thank you.
Does it really "crash" (panics as we know), or does it simply leave? Try using TRAP/D.
Let us say, you haveWhat happens if you modify it toCode:void CSomething::YourMethodL(TContactItemId aId) { CPbkContactItem *item=iSomething->ReadContactL(aId); CleanupStack::PushL(item); ... do things ... CleanupStack::PopAndDestroy(); // item }?Code:void CSomething::YourMethodL(TContactItemId aId) { TRAPD(err, CPbkContactItem *item=iSomething->ReadContactL(aId); CleanupStack::PushL(item); ... do things ... CleanupStack::PopAndDestroy(); // item ); }
The problem was that I was using TRAPD with ReadContactLC() function. But It is not recommended to call a function with an LC suffix from inside a trap harness. Thats why I try it as following:
TRAPD(err, Citem = iDatabase->ReadContactLC((*contacts)[i]); CleanupStack::Pop(Citem));
The application started behaving very strange. The function in which I was using the above line was called again automatically.
Then I used ReadContactL() instead of ReadContactLC() and it solved the problem.
Thanks everyone for the contribution.