• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Saving contacts from call log

Hi all,
To save contacts from call Log through ASE is not going to be a challenging ask i guess.I have tried the following Steps.
Step 1: Get the last dialed number from call log.
Step 2: Save the number by using addContact() method from ContactsFacade.java

//Code to get the dialed number from callLog.
public String saveFromCallLog()
{

String lastDialedNumber =
CALLLOG_EMPTY;
String[] projection =
new String[]{Calls.NUMBER};
try

{
c = mService.getContentResolver().query(CONTENT_URI, projection, null, null, null);
if(c != null)
{
c.moveToLast();
lastDialedNumber =
c.getString(0);
}


}
catch(Exception e)
{
e.getMessage();
}
finally

{
c.close();
}
return lastDialedNumber;


}
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones