于Symbian OS的通讯录操作总结
2010-05-31 20:12:00 来源:WEB开发网TInt count = filter->iIds->Count();
CleanupStack::PopAndDestroy(2); // filter contactsDb
注:在某些symbian手机中,若没有设定DateTime可能会出现错误。
6、数据库查询
所用的函数有:
CContactDatabase::FindLC() ;
CContactDatabase::FindInTextDefLC();.
FindInTextDefLC() ;
FindInTextDefAsyncL();
例1、 FindInTextDefAsyncL()的应用:
iContactsDb = CContactDatabase::OpenL();
iFieldDef = new (ELeave)CContactItemFieldDef();
iFieldDef->AppendL(KUidContactFieldGivenName);
iFieldDef->AppendL(KUidContactFieldFamilyName);
_LIT(KFindToken, "Bond");
iFinder =
iContactsDb->FindAsyncL( KFindToken, iFieldDef, this);
if(iFinder->IsComplete())
{
if(iFinder->Error() == KErrNone)
{
CContactIdArray* result = iFinder->TakeContactIds();
for(TInt i=0; i
{
TInt cardId = (*result)[i];
// do something with the card
}
delete result;
}
delete iFinder;
delete iFieldDef;
delete iContactsDb;
}
更多精彩
赞助商链接