Rohit Surwase
12/01/2018, 6:09 AMfun insertNewData(oldList: List<String>, finalList: List<String>, callback: () -> Unit) {
launch(<http://Dispatchers.IO|Dispatchers.IO>) {
async {
//1. Call function to delete old relations
// Delete query on JoinTable
//2.Call function to get IDs for new data
// Select query on TableOne
//3. Call function to assign new relations
// Insert query on JoinTable
}.await()
callback()
}
}
Is it a good setup or there are better ways?
Another thing, I am using LiveData but for few cases prefer a lambda function as callback where I want to listen for a response only once.