Android(JetPack)学习(12)Room2
作者:互联网
viewmodel向后一步,设立仓库Repository
static class InsertTask extends AsyncTask<Word,Void,Void>{
private WordDao wordDao;
public InsertTask(WordDao wordDao) {
this.wordDao = wordDao;
}
@Override
protected Void doInBackground(Word... words) {
wordDao.insertW(words);
return null;
}
}
static class UpdateTask extends AsyncTask<Word,Void,Void>{
private WordDao wordDao;
public UpdateTask(WordDao wordDao) {
this.wordDao = wordDao;
}
@Override
protected Void doInBackground(Word... words) {
wordDao.updateW(words);
return null;
}
}
static class DeleteTask extends AsyncTask<Word,Void,Void> {
private WordDao wordDao;
public DeleteTask(WordDao wordDao) {
this.wordDao = wordDao;
}
@Override
protected Void doInBackground(Word... words) {
wordDao.deleteW(words);
return null;
}
}
static class DeleteAllTask extends AsyncTask<Void,Void,Void> {
private WordDao wordDao;
public DeleteAllTask(WordDao wordDao) {
this.wordDao = wordDao;
}
@Override
protected Void doInBackground(Void...Void) {
wordDao.deleteALLW();
return null;
}
}
标签:12,JetPack,Void,private,WordDao,AsyncTask,words,Android,wordDao 来源: https://blog.csdn.net/qq_43352282/article/details/104746931