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 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;
- ››Android 当修改一些代码时,使用什么编译命令可以最...
- ››Android 如何添加一个apk使模拟器和真机都编译进去...
- ››Android 修改Camera拍照的默认保存路径
- ››Android 如何修改默认输入法
- ››android开发中finish()和System.exit(0)的区别
- ››Android手势识别简单封装类
- ››android中查看项目数字证书的两种方法
- ››Android中获取IMEI码的办法
- ››android 相机报错 setParameters failed
- ››Android重启运用程序的代码
- ››Android为ListView的Item设置不同的布局
- ››android bitmap与base64字符串的互相转换
更多精彩
赞助商链接