本文整理了Java中com.j256.ormlite.dao.Dao.unregisterObserver()
方法的一些代码示例,展示了Dao.unregisterObserver()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dao.unregisterObserver()
方法的具体详情如下:
包路径:com.j256.ormlite.dao.Dao
类名称:Dao
方法名:unregisterObserver
[英]Remove the observer from the registered list.
[中]从注册列表中删除观察者。
代码示例来源:origin: j256/ormlite-core
@Override
public void unregisterObserver(DaoObserver observer) {
dao.unregisterObserver(observer);
}
代码示例来源:origin: com.j256.ormlite/ormlite-core
@Override
public void unregisterObserver(DaoObserver observer) {
dao.unregisterObserver(observer);
}
代码示例来源:origin: com.j256.ormlite/ormlite-android
@Override
protected void onReset() {
super.onReset();
// ensure the loader is stopped
onStopLoading();
if (cachedResults != null) {
cachedResults.clear();
cachedResults = null;
}
// stop watching for changes
dao.unregisterObserver(this);
}
代码示例来源:origin: com.j256.ormlite/ormlite-android
@Override
protected void onReset() {
super.onReset();
onStopLoading();
if (cursor != null) {
if (!cursor.isClosed()) {
cursor.close();
}
cursor = null;
}
// stop watching for changes
dao.unregisterObserver(this);
}
代码示例来源:origin: com.j256.ormlite/ormlite-android
@Override
protected void onReset() {
super.onReset();
onStopLoading();
if (cursor != null) {
if (!cursor.isClosed()) {
cursor.close();
}
cursor = null;
}
// stop watching for changes
dao.unregisterObserver(this);
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testDaoObserver() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
final AtomicInteger changeCount = new AtomicInteger();
DaoObserver obverver = new DaoObserver() {
@Override
public void onChange() {
changeCount.incrementAndGet();
}
};
dao.registerObserver(obverver);
assertEquals(0, changeCount.get());
Foo foo = new Foo();
foo.val = 21312313;
assertEquals(1, dao.create(foo));
assertEquals(1, changeCount.get());
foo.val = foo.val + 1;
assertEquals(1, dao.create(foo));
assertEquals(2, changeCount.get());
// shouldn't change anything
dao.queryForAll();
assertEquals(2, changeCount.get());
assertEquals(1, dao.delete(foo));
assertEquals(3, changeCount.get());
dao.unregisterObserver(obverver);
assertEquals(1, dao.create(foo));
// shouldn't change not that we have removed the observer
assertEquals(3, changeCount.get());
}
内容来源于网络,如有侵权,请联系作者删除!