package com.test.contentobserver;
import android.app.Activity;
import android.database.ContentObserver;
import android.os.Bundle;
import android.provider.Contacts.People;
public class TestContentObserver extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.getApplicationContext().getContentResolver().registerContentObserver (People.CONTENT_URI, true, contentObserver);
}
private class MyContentObserver extends ContentObserver {
public MyContentObserver() {
super(null);
}
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
}
}
MyContentObserver contentObserver = new MyContentObserver();
}
android 监听联系人数据库
最新推荐文章于 2021-05-26 07:38:28 发布