开发学院手机开发Android 开发 Android Call Log and SMS Delete 电话记录和短信... 阅读

Android Call Log and SMS Delete 电话记录和短信删除

 2010-07-19 23:02:00 来源:WEB开发网   
核心提示:Java代码public class CallContentObserver extends ContentObserver {private final static String strUriInbox = "content://call_log/calls";private final sta

Java代码

public class CallContentObserver extends ContentObserver {

private final static String strUriInbox = "content://call_log/calls";

private final static Uri uriCall = Uri.parse(strUriInbox);

private String phoneNum;

private Context context;

public CallContentObserver(Context context, String phoneNum, Handler handler) {

super(handler);

this.context = context;

this.phoneNum = phoneNum;

}

@Override

public void onChange(boolean selfChange) {

super.onChange(selfChange);

Cursor c = context.getContentResolver().query(uriCall,

new String[] { "_id", "number", "date" }, null, null, null);

if (c != null && c.moveToFirst()) {

String num = c.getString(1);

String id = c.getString(0);

if (num != null && num.equals(phoneNum)) {

context.getContentResolver().delete(uriCall, "_id=" + id,

null);

}

// for(int i =0; i < c.getColumnCount(); i++)

// {

// String strColumnName = c.getColumnName(i);

// String strColumnValue = c.getString(i);

// Log.e("i", "i="+i);

// Log.e("strColumnName", "strColumnName="+strColumnName);

// Log.e("strColumnValue", "strColumnValue="+strColumnValue);

// }

c.close();

}

}

}

public class CallContentObserver extends ContentObserver {

private final static String strUriInbox = "content://call_log/calls";

private final static Uri uriCall = Uri.parse(strUriInbox);

private String phoneNum;

private Context context;

public CallContentObserver(Context context, String phoneNum, Handler handler) {

super(handler);

this.context = context;

this.phoneNum = phoneNum;

1 2  下一页

Tags:Android Call Log

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
更多精彩
    赞助商链接

    热点阅读
      焦点图片
        最新推荐
          精彩阅读