use of sqlite.feature.livedata.persistence0.BindApp0DaoFactory in project kripton by xcesco.
the class TestLiveDataRuntime method testRun.
@Test
public void testRun() throws InterruptedException {
// .build(DataSourceOptions.builder().inMemory(false).build());
BindApp0DataSource ds = BindApp0DataSource.instance();
System.out.println("aa" + KriptonTaskExecutor.getInstance().isMainThread());
LiveData<List<Person>> liveData = ds.getDaoPerson0().select("Manero");
liveData.observeForever(new Observer<List<Person>>() {
@Override
public void onChanged(List<Person> t) {
System.out.println("*********** " + t.size());
}
});
ds.execute(new BindApp0DataSource.Transaction() {
@Override
public TransactionResult onExecute(BindApp0DaoFactory daoFactory) {
Person person = new Person();
person.name = "Manero";
person.surname = "Tonj";
daoFactory.getDaoPerson0().insert(person);
return TransactionResult.COMMIT;
}
});
Thread.sleep(1000);
}
Aggregations