Wednesday, April 28, 2010

[android-developers] Delete Current Call Log Entry

hi guys,

i have a application which capture the incoming/ outgoing calls. so i
want to delete those imcoming/ outgoing call entries from CallLog. i
have tried to do it but everytime it deletes the others but not the
current call Log.

this is my method

public void clearCallLog() {
Cursor c =
getContentResolver().query(Calls.CONTENT_URI, null,
Calls.NUMBER + "='" + mobileNumber +
"'", null,
Calls.DATE + " DESC");
getContentResolver().cancelSync(Calls.CONTENT_URI);
startManagingCursor(c);
String number = null;
String date;
int dateColumn = c.getColumnIndex(Calls.DATE);
int numberColumn = c.getColumnIndex(Calls.NUMBER);
if (c != null) {
if (c.moveToFirst()) {
// do {
// Get the field values
date = c.getString(dateColumn);
number = c.getString(numberColumn);
Log.d("NUmber", number);
Log.d("Date", date);
alert("number", number);
// } while (c.moveToNext());
}
int i
=getContentResolver().delete(Calls.CONTENT_URI,
Calls.NUMBER + "='" + number +
"'", null);
alert("Delete", Integer.toString(i));
}
}

any suggestions???

regards,
Randika

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment