Hi I this this code would solve your Purpose.
* This class newly added by Shyam Ananthakrishnan, is meant to
manipulate with the Android call log.
* Author : Android Automation Team - Shyam Ananthakrishnan
([email protected])
* Date : 2nd July 2010
* Purpose: ASE functions that manipulates around the Call log feature
like monitoring the call log counter,
* Deleting the entries in call log etc.
*/
package com.google.ase.facade;
import android.app.Activity;
import android.app.Service;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.provider.CallLog;
import com.google.ase.jsonrpc.RpcReceiver;
import com.google.ase.rpc.Rpc;
/************************************* Enhanced by Shyam
Ananthakrishnan**************************/
public class CallLogFacade extends Activity implements RpcReceiver {
private final Service mService;
private static final Uri CONTENT_URI = Uri.parse("content://call_log/
calls");
Cursor c = null;
// constructor that initializes the Service.
public CallLogFacade(Service service) {
mService = service;
}
@Rpc(description = "gets the count from the call log")
public int callLogCount()
{
try
{
//String[] projection = new String []{Calls._ID};
c = mService.getContentResolver().query(CONTENT_URI,
null,null,null,null);
System.out.println("Cursor Count"+c.getCount());
}
catch(Exception e)
{
e.getMessage();
}
return c.getCount();
}
@Rpc(description = "Deletes all the call Log Entries")
public void deleteEntriesFromCallLog()
{
try
{
ContentResolver cr = mService.getContentResolver();
Uri uri = CONTENT_URI;
cr.delete(uri, null, null);
}
catch(Exception e)
{
e.getMessage();
}
}
@Rpc(description = "Deletes an Entry from call Log ")
public void deleteAnEntryFromCallLog(String number)
{
try
{
Uri CALLLOG_URI = Uri.parse("content://call_log/calls");
mService.getContentResolver().delete(CALLLOG_URI,CallLog.Calls.NUMBER
+"=?",new String[]{number});
}
catch(Exception e)
{
e.getMessage();
}
}
/************************************* EOD - Shyam
Ananthakrishnan**************************/
On Jun 21, 4:29 pm, mike <[email protected]> wrote:
> hi Bibek,
>
> which is a good point. so i decide to update thecalllogfor the same
> uri. then i'm getting a null pointer exception.
>
> int x = context.getContentResolver().update(uri, null, null,null);
>
> what will be the issue?? do i have to pass values here??
>
> regards,
> MIke
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en