hi Galbayar,
What exactly did u mean by use _id, i don't know the id what i know is
the mobile number. that method delete all the log's for that number
expect for the current call. that's the issue
i'm using this method in here
class StateListener extends PhoneStateListener {
@Override
public void onCallStateChanged(int state, String
incomingNumber) {
// TODO Auto-generated method stub
// super.onCallStateChanged(state, incomingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_RINGING:
phonenbr = incomingNumber;
break;
case TelephonyManager.CALL_STATE_IDLE:
clearCallLog(phonenbr);
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
phonenbr = incomingNumber;
break;
}
}
}
public void clearCallLog(String mobileNumber) {
Cursor c = context.getContentResolver().query(
CallLog.Calls.CONTENT_URI, null,
Calls.NUMBER + "='" + mobileNumber + "'", null,
Calls.DATE + " DESC");
context.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 =
context.getContentResolver().delete(Calls.CONTENT_URI,
Calls.NUMBER + "='" + number + "'",
null);
Log.d("DELETE ID", Integer.toString(i));
//telManager.listen(new StateListener(), LISTEN_NONE);
System.exit(0);
// finish();
// alert("Delete", Integer.toString(i));
}
}
what i think is in TelephonyManager.CALL_STATE_IDLE state the current
call entry is not there. can it be the reason, but logically that too
can't happen. because the call is already over so the entry should be
there
so can you help me
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 [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