刚开始使用GreenDao,不是很熟悉。还有一个就是,更新数据之后要怎么才能立即刷新数据呢?
巴扎黑2017-04-17 17:39:19
GreenDao provides a unified interface class AsyncSession for asynchronous operations, which provides all the asynchronous operation methods you need.
You can get an AsyncSession instance by calling DaoSession.startAsyncSession().
DBManager.getInstance().getDaoSession().startAsyncSession().runInTx(new Runnable() {
@Override
public void run() {
//DELETE
//DELETE
//UPDATE
}
});
You can also open a thread yourself.
Batch database operations can use GreenDao transactions.
大家讲道理2017-04-17 17:39:19
All time-consuming operations in Android should be placed in child threads. Reading and writing databases are time-consuming operations.
After data acquisition, use the corresponding adapter to refresh it.