单线程例子
程序员文章站
2022-05-15 23:53:44
...
由于sqlite不支持并发,所以我们使用单线程
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
singleThreadExecutor.execute(new Runnable() {
@Override
public void run() {
// db operetions, u can use handler to send message after
db.insert(yourTableName, null, value);
handler.sendEmptyMessage(xx);
}
});