刚开始使用GreenDao,不是很熟悉。还有一个就是,更新数据之后要怎么才能立即刷新数据呢?
走同样的路,发现不同的人生
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.
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.
Many operations of the realm database can be done on the main thread
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().
You can also open a thread yourself.
Batch database operations can use GreenDao transactions.
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.
Many operations of the realm database can be done on the main thread